当前位置: 首页 > 文档资料 > Kubernetes 指南 >

Helm - Helm 参考

优质
小牛编辑
136浏览
2023-12-01

查询 charts

  1. helm search
  2. helm search mysql

查询 package 详细信息

  1. helm inspect stable/mariadb

部署 package

  1. helm install stable/mysql

部署之前可以自定义 package 的选项:

  1. # 查询支持的选项
  2. helm inspect values stable/mysql
  3. # 自定义 password
  4. echo "mysqlRootPassword: passwd" > config.yaml
  5. helm install -f config.yaml stable/mysql

另外,还可以通过打包文件(.tgz)或者本地 package 路径(如 path/foo)来部署应用。

查询服务 (Release) 列表

  1. ➜ ~ helm ls
  2. NAME REVISION UPDATED STATUS CHART NAMESPACE
  3. quieting-warthog 1 Tue Feb 21 20:13:02 2017 DEPLOYED mysql-0.2.5 default

查询服务 (Release) 状态

  1. ➜ ~ helm status quieting-warthog
  2. LAST DEPLOYED: Tue Feb 21 16:13:02 2017
  3. NAMESPACE: default
  4. STATUS: DEPLOYED
  5. RESOURCES:
  6. ==> v1/Secret
  7. NAME TYPE DATA AGE
  8. quieting-warthog-mysql Opaque 2 9m
  9. ==> v1/PersistentVolumeClaim
  10. NAME STATUS VOLUME CAPACITY ACCESSMODES AGE
  11. quieting-warthog-mysql Bound pvc-90af9bf9-f80d-11e6-930a-42010af00102 8Gi RWO 9m
  12. ==> v1/Service
  13. NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
  14. quieting-warthog-mysql 10.3.253.105 <none> 3306/TCP 9m
  15. ==> extensions/v1beta1/Deployment
  16. NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
  17. quieting-warthog-mysql 1 1 1 1 9m
  18. NOTES:
  19. MySQL can be accessed via port 3306 on the following DNS name from within your cluster:
  20. quieting-warthog-mysql.default.svc.cluster.local
  21. To get your root password run:
  22. kubectl get secret --namespace default quieting-warthog-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo
  23. To connect to your database:
  24. 1. Run an Ubuntu pod that you can use as a client:
  25. kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il
  26. 2. Install the mysql client:
  27. $ apt-get update && apt-get install mysql-client -y
  28. 3. Connect using the mysql cli, then provide your password:
  29. $ mysql -h quieting-warthog-mysql -p

升级和回滚 Release

  1. # 升级
  2. cat "mariadbUser: user1" >panda.yaml
  3. helm upgrade -f panda.yaml happy-panda stable/mariadb
  4. # 回滚
  5. helm rollback happy-panda 1

删除 Release

  1. helm delete quieting-warthog

repo 管理

  1. # 添加 incubator repo
  2. helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
  3. # 查询 repo 列表
  4. helm repo list
  5. # 生成 repo 索引(用于搭建 helm repository)
  6. helm repo index

chart 管理

  1. # 创建一个新的 chart
  2. helm create deis-workflow
  3. # validate chart
  4. helm lint
  5. # 打包 chart 到 tgz
  6. helm package deis-workflow

Helm 命令参考

  1. completion Generate bash autocompletions script
  2. create create a new chart with the given name
  3. delete given a release name, delete the release from Kubernetes
  4. dependency manage a chart's dependencies
  5. fetch download a chart from a repository and (optionally) unpack it in local directory
  6. get download a named release
  7. history fetch release history
  8. home displays the location of HELM_HOME
  9. init initialize Helm on both client and server
  10. inspect inspect a chart
  11. install install a chart archive
  12. lint examines a chart for possible issues
  13. list list releases
  14. package package a chart directory into a chart archive
  15. repo add, list, remove, update, and index chart repositories
  16. reset uninstalls Tiller from a cluster
  17. rollback roll back a release to a previous revision
  18. search search for a keyword in charts
  19. serve start a local http web server
  20. status displays the status of the named release
  21. test test a release
  22. upgrade upgrade a release
  23. verify verify that a chart at the given path has been signed and is valid
  24. version print the client/server version information
  25. Flags:
  26. --debug enable verbose output
  27. --home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm")
  28. --host string address of tiller. Overrides $HELM_HOST
  29. --kube-context string name of the kubeconfig context to use
  30. --tiller-namespace string namespace of tiller (default "kube-system")