hyscaleという2020年の1月に入ってオープンソースになったツールを触ってみようと思います。
hyscaleとはkubernetesのデプロイツールであり、dockerfileの作成、build、マニフェストの作成、デプロイ
等をやってくれるツールだそうで、k8sのyaml地獄から解放してくれるか?という希望のもと触ってみようと思います。
環境構築
とりあえずgithub( https://github.com/hyscale/hyscale )を見たところ、macで入れるにはjavaが必要であったり、windowsのinstallerがなかったりするためconohaというサービスのVPSでdocker入のubuntu imageから始めます。
kubernetes
とりあえずkubernetesがいるのでkubectlとkindを入れます。
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.6.1/kind-$(uname)-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/kind
kubectlはcliツールで、kindはdocker上でkubernetesを動かすためのツールです。
hyscale
そしてhyscale入れます。
curl -sSL http://get.hyscale.io | bash
これでhyscale
コマンドを叩くとエラーが出ました。そういえばgithub上の情報によるとdocker loginしていないと駄目みたいなのでよしなに行い、$HOME/.docker/config.json
にauthの情報が入っているようにしておきます。
Image registry credentials at $HOME/.docker/config.json . Make sure config.json has the latest auth creds by logging into the image registry using docker login prior to deployment.
すると次のような画面になります。
sampleを動かしてみる
とりあえず何もわからないのでsampleをそのまま動かしてみます。
name: myservice
image:
registry: registry.hub.docker.com
name: library/tomcat
tag: 8.5.0-jre8
volumes:
- name: tomcat-logs-dir
path: /usr/local/tomcat/logs
size: 1Gi
storageClass: standard
external: true
ports:
- port: 8080/tcp
healthCheck:
httpPath: /docs/images/tomcat.gif
するとこんな感じの出力です。Javaで動いているためか、コマンドの実行から出力が得られるまでがかなり待たされる印象です。
root@163-44-169-246:~# hyscale deploy service -f sample.yml -n default -a test
_ _
| |__ _ _ ___ ___ __ _| | ___
| '_ \| | | / __|/ __/ _` | |/ _ \
| | | | |_| \__ \ (_| (_| | | __/
|_| |_|\__, |___/\___\__,_|_|\___|
|___/
************************** SERVICE: myservice **************************
************************** Dockerfile Generation **************************
[ACTION] Generating Dockerfile ............................................................ [SKIPPED]
************************** Image build and Push **************************
[ACTION] Image build and push ............................................................. [SKIPPED]
************************** Manifest Generation **************************
[ACTION] Generating manifest for Service .................................................. [DONE]
[ACTION] Generating manifest for StatefulSet .............................................. [DONE]
************************** ERROR **************************
[ERROR] REASON :: [No storage class defined in your kubernetes cluster. Please contact your cluster administrator]
************************** Deployment info **************************
[INFO] Total time : 0s
[INFO] Manifests path : /root/.hyscale/hyscale/apps/test/myservice/generated-files/manifests/
********************************************************************************************************
public cloudではなくkindで作成したclusterなため、No storage class defined
と怒られてしまったので、とりあえずvolume関連は今回は削除してみます。
root@163-44-169-246:~# hyscale deploy service -f sample.yml -n default -a test
_ _
| |__ _ _ ___ ___ __ _| | ___
| '_ \| | | / __|/ __/ _` | |/ _ \
| | | | |_| \__ \ (_| (_| | | __/
|_| |_|\__, |___/\___\__,_|_|\___|
|___/
************************** SERVICE: myservice **************************
************************** Dockerfile Generation **************************
[ACTION] Generating Dockerfile ............................................................ [SKIPPED]
************************** Image build and Push **************************
[ACTION] Image build and push ............................................................. [SKIPPED]
************************** Manifest Generation **************************
[ACTION] Generating manifest for Service .................................................. [DONE]
[ACTION] Generating manifest for Deployment ............................................... [DONE]
************************** Deployment **************************
************************** ERROR **************************
[ERROR] REASON :: [Failed to create resource Namespace]
************************** Deployment info **************************
[INFO] Total time : 1s
[INFO] Manifests path : /root/.hyscale/hyscale/apps/test/myservice/generated-files/manifests/
********************************************************************************************************
なぜか[ERROR] REASON :: [Failed to create resource Namespace]
というエラーが出ますね。namespaceを作成する権限がないということはないと思うのですが、いまいち原因がわかりません。