k8s~helm的安裝過程

上一講說了一些helm的基本概念,而今天主要說一下如何把helm部署到服務器上,在helm3以前的版本里,它由客戶端helm和服務端tiller組成,而helm3.0以後它去掉了tiller,而直接與k8s通信,能夠說在部署上更簡單了,而今天咱們主要仍是部署2.x版本的helm.linux

下載安裝包

https://get.helm.sh/helm-v2.16.5-linux-amd64.tar.gz

腳本文檔rbac-config.yml

apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system

構建rbac

kubectl create -f rbac-config.yaml

初始化tiller

helm init --service-account tiller --skip-refresh

對於 Kubernetes v1.16.0 以上的版本,有可能會碰到 Error: error installing: the server could not find the requested resource 的錯誤。這是因爲 extensions/v1beta1 已經被 apps/v1 替代。相信在2.15 或者 3 版本發佈以後, 應該就不會遇到這個問題了。仍是生態比較慢的緣由。api

從新初始化tiller

helm init -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.14.3 --stable-repo-url http://mirror.azure.cn/kubernetes/charts/ --service-account tiller --override spec.selector.matchLabels.'name'='tiller',spec.selector.matchLabels.'app'='helm' --output yaml | sed 's@apiVersion: extensions/v1beta1@apiVersion: apps/v1@' | kubectl apply -f -

查看tiller的pod信息

kubectl get pods -n kube-system | grep tiller
tiller-deploy-7c7b67c9fd-kxh6p            1/1     Running     0          4m58s

到如今爲止,咱們的helm就安裝功能了,以後咱們裝運行helm來進行charts的安裝服務器

相關文章
相關標籤/搜索