$ helm fetch stable/mysql --version 0.2.8 --untar $ ls mysql/ Chart.yaml README.md templates values.yaml
$ helm lint mysql ==> Linting mysql Lint OK 1 chart(s) linted, no failures
$ helm create mychart Creating mychart
mychart/ |-- charts |-- Chart.yaml |-- templates | |-- deployment.yaml | |-- _helpers.tpl | |-- ingress.yaml | |-- NOTES.txt | `-- service.yaml `-- values.yaml 2 directories, 7 files
helm install -f myvalues.yaml ./redis
$ helm install --set name=prod ./redis
$ helm install -n mysql -f mysql/values.yaml --set resources.requests.memory=512Mi mysql NAME: mysql LAST DEPLOYED: Thu Sep 14 05:48:31 2017 NAMESPACE: default STATUS: DEPLOYED RESOURCES: ==> v1beta1/Deployment NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE mysql-mysql 1 1 1 0 0s ==> v1/Secret NAME TYPE DATA AGE mysql-mysql Opaque 2 0s ==> v1/ConfigMap NAME DATA AGE mysql-configmap 1 0s ==> v1/PersistentVolumeClaim NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE mysql-mysql Pending 0s ==> v1/Service NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE mysql-mysql 10.98.221.433306/TCP 0s NOTES: MySQL can be accessed via port 3306 on the following DNS name from within your cluster: mysql-mysql.default.svc.cluster.local To get your root password run: kubectl get secret --namespace default mysql-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo To connect to your database: Run an Ubuntu pod that you can use as a client: kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il Install the mysql client: $ apt-get update && apt-get install mysql-client -y Connect using the mysql cli, then provide your password: $ mysql -h mysql-mysql -p
$ helm status mysql LAST DEPLOYED: Tue Sep 12 07:31:49 2017 NAMESPACE: default STATUS: DEPLOYED
$ helm list -a $ helm list -a | grep mysqlmysql 1 Tue Sep 12 07:31:49 2017 DEPLOYED mysql-0.2.8 default
$ helm upgrade mysql -f mysql/values.yaml --set resources.requests.memory=1024Mi mysql
$ helm hist mysql REVISION UPDATED STATUS CHART DESCRIPTION 1 Tue Sep 12 07:31:49 2017 SUPERSEDED mysql-0.2.8 Install complete 2 Tue Sep 12 07:44:00 2017 DEPLOYED mysql-0.2.8 Upgrade complete
$ helm get --revision 1 mysql resources: requests: cpu: 100m memory: 512Mi $ helm get --revision 2 mysql resources: requests: cpu: 100m memory: 1024Mi
helm rollback --debug mysql 1 [debug] Created tunnel using local port: '60303' [debug] SERVER: "localhost:60303" Rollback was a success! Happy Helming!
$ helm hist mysql REVISION UPDATED STATUS CHART DESCRIPTION 1 Tue Sep 12 07:31:49 2017 SUPERSEDED mysql-0.2.8 Install complete 2 Tue Sep 12 07:44:00 2017 SUPERSEDED mysql-0.2.8 Upgrade complete 3 Tue Sep 12 08:50:48 2017 DEPLOYED mysql-0.2.8 Rollback to 1
$ helm delete mysql release "mysql" deleted
$ helm ls -a mysql NAME REVISION UPDATED STATUS CHART NAMESPACE mysql 3 Tue Sep 12 08:50:48 2017 DELETED mysql-0.2.8 default
$ helm hist mysql REVISION UPDATED STATUS CHART DESCRIPTION 1 Tue Sep 12 07:31:49 2017 SUPERSEDED mysql-0.2.8 Install complete 2 Tue Sep 12 07:44:00 2017 SUPERSEDED mysql-0.2.8 Upgrade complete 3 Tue Sep 12 08:50:48 2017 DELETED mysql-0.2.8 Deletion complete
$ helm rollback --debug mysql 2 [debug] Created tunnel using local port: '37413' [debug] SERVER: "localhost:37413" Rollback was a success! Happy Helming!
$ helm delete --purge mysql release "mysql" deleted
$ helm hist mysql Error: release: "mysql" not found
欢迎转载,请注明作者出处:张夏,FreeWheel Lead Engineer,DockOne社区
原文发布时间为:2017-09-14
本文作者:张夏
本文来自云栖社区合作伙伴Dockerone.io,了解相关信息可以关注Dockerone.io。
原文标题:简化Kubernetes应用部署工具-Helm之应用部署