安装 Helm client

Helm的安装方式有两种:预编译的二进制程序和源码编译安装。

helm项目地址: https://github.com/kubernetes/helm

这里使用二进制程序的2.14.2版本Helm

  1. cd ~ && wget https://get.helm.sh/helm-v2.14.2-linux-amd64.tar.gz
  2. tar -xf helm-v2.14.2-linux-amd64.tar.gz
  3. cp -a linux-amd64/helm /usr/local/bin/

Helm 命令使用帮助

  1. helm help
  2. The Kubernetes package manager
  3. To begin working with Helm, run the 'helm init' command:
  4. $ helm init
  5. This will install Tiller to your running Kubernetes cluster.
  6. It will also set up any necessary local configuration.
  7. Common actions from this point include:
  8. - helm search: search for charts
  9. - helm fetch: download a chart to your local directory to view
  10. - helm install: upload the chart to Kubernetes
  11. - helm list: list releases of charts
  12. Environment:
  13. - $HELM_HOME: set an alternative location for Helm files. By default, these are stored in ~/.helm
  14. - $HELM_HOST: set an alternative Tiller host. The format is host:port
  15. - $HELM_NO_PLUGINS: disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins.
  16. - $TILLER_NAMESPACE: set an alternative Tiller namespace (default "kube-system")
  17. - $KUBECONFIG: set an alternative Kubernetes configuration file (default "~/.kube/config")
  18. - $HELM_TLS_CA_CERT: path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default "$HELM_HOME/ca.pem")
  19. - $HELM_TLS_CERT: path to TLS client certificate file for authenticating to Tiller (default "$HELM_HOME/cert.pem")
  20. - $HELM_TLS_KEY: path to TLS client key file for authenticating to Tiller (default "$HELM_HOME/key.pem")
  21. - $HELM_TLS_ENABLE: enable TLS connection between Helm and Tiller (default "false")
  22. - $HELM_TLS_VERIFY: enable TLS connection between Helm and Tiller and verify Tiller server certificate (default "false")
  23. - $HELM_TLS_HOSTNAME: the hostname or IP address used to verify the Tiller server certificate (default "127.0.0.1")
  24. - $HELM_KEY_PASSPHRASE: set HELM_KEY_PASSPHRASE to the passphrase of your PGP private key. If set, you will not be prompted for the passphrase while signing helm charts
  25. Usage:
  26. helm [command]
  27. Available Commands:
  28. completion Generate autocompletions script for the specified shell (bash or zsh)
  29. create create a new chart with the given name
  30. delete given a release name, delete the release from Kubernetes
  31. dependency manage a chart's dependencies
  32. fetch download a chart from a repository and (optionally) unpack it in local directory
  33. get download a named release
  34. help Help about any command
  35. history fetch release history
  36. home displays the location of HELM_HOME
  37. init initialize Helm on both client and server
  38. inspect inspect a chart
  39. install install a chart archive
  40. lint examines a chart for possible issues
  41. list list releases
  42. package package a chart directory into a chart archive
  43. plugin add, list, or remove Helm plugins
  44. repo add, list, remove, update, and index chart repositories
  45. reset uninstalls Tiller from a cluster
  46. rollback roll back a release to a previous revision
  47. search search for a keyword in charts
  48. serve start a local http web server
  49. status displays the status of the named release
  50. template locally render templates
  51. test test a release
  52. upgrade upgrade a release
  53. verify verify that a chart at the given path has been signed and is valid
  54. version print the client/server version information
  55. Flags:
  56. --debug enable verbose output
  57. -h, --help help for helm
  58. --home string location of your Helm config. Overrides $HELM_HOME (default "/home/appuser/.helm")
  59. --host string address of Tiller. Overrides $HELM_HOST
  60. --kube-context string name of the kubeconfig context to use
  61. --kubeconfig string absolute path to the kubeconfig file to use
  62. --tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300)
  63. --tiller-namespace string namespace of Tiller (default "kube-system")
  64. Use "helm [command] --help" for more information about a command.

安装Tiller Server

1、 首先需要在创建 Tiller Server的 Serviceaccount

  1. vim tiller_rbac.yaml
  2. apiVersion: v1
  3. kind: ServiceAccount
  4. metadata:
  5. name: tiller
  6. namespace: mobile
  7. ---
  8. apiVersion: rbac.authorization.k8s.io/v1beta1
  9. kind: ClusterRoleBinding
  10. metadata:
  11. name: tiller
  12. roleRef:
  13. apiGroup: rbac.authorization.k8s.io
  14. kind: ClusterRole
  15. name: cluster-admin
  16. subjects:
  17. - kind: ServiceAccount
  18. name: tiller
  19. namespace: mobile

2、创建上面的资源清单创建资源

  1. kubectl apply -f tiller-rbac.yaml

3、创建tiller server

  1. #国内拉不到镜像
  2. helm init --service-account tiller --tiller-namespace=mobile
  1. #使用国内镜像
  2. helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.9.0 --service-account=tiller --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts --tiller-namespace=mobile
  1. #阿里镜像不全可以使用aws的
  2. stable: http://mirror.azure.cn/kubernetes/charts/
  3. incubator: http://mirror.azure.cn/kubernetes/charts-incubator/

helm init常用配置项如下:

  1. --canary-image:安装canary分之,即项目Master的分支
  2. --tiller-image:安装指定image,默认通Helm版本
  3. --kube-context:安装到指定的kubernetes集群
  4. --tiller-namespace:安装到指定的namespace中,默认为kube-system
  5. --upgrade:如果tiller server已经被安装了,可以使用此选项更新镜像
  6. --service-account:用于指定运行tiller serverserviceaccount,该account需要事先在kubernetes集群中创建,且需要相应的rbac授权

4、卸载Tiller的方法常用的两种方式

  1. #1
  2. kubectl delete deployment tiller-deploy --namespace kube-system
  3. #2
  4. helm reset
文档更新时间: 2022-02-09 09:41   作者:张尚