美文网首页
kubernetes包管理工具helm和tiller的安装

kubernetes包管理工具helm和tiller的安装

作者: WJXZ | 来源:发表于2018-11-10 21:46 被阅读0次

1.先决条件本地的kubectl 可以连接到远程的k8s

2.下载helm->参考

linux amd64

3.安装helm

tar -zxvf helm-v2.11.0-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
#helm help验证安装成功

4. 添加tiller到 [k8s] service account

#vim serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: tiller
  namespace: kube-system
#:wq保存
#kubectl apply -f serviceaccount.yaml

kubectl create serviceaccount --namespace kube-system tiller
# vim clusterrolebinding.yaml
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
#:wq保存
#kubectl apply -f clusterrolebinding.yaml

kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller

5.用阿里云tiller镜像及tiller账户初始化helm, 将tiller部署到[k8s] deployment下.

helm init --service-account tiller --upgrade --tiller-image=registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.11.0
#若您已经在k8s部署了tiller则只需要执行
helm init  --client-only
#vim ~/.helm/repository/repositories.yaml
apiVersion: v1
generated: 2018-11-10T20:32:27.187074383+08:00
repositories:
- caFile: ""
  cache: /root/.helm/repository/cache/stable-index.yaml
  certFile: ""
  keyFile: ""
  name: stable
  password: "password"
  url: https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
  username: "username"
- caFile: ""
  cache: /root/.helm/repository/cache/local-index.yaml
  certFile: ""
  keyFile: ""
  name: local
  password: ""
  url: http://127.0.0.1:8879/charts
  username: ""

6.检查tiller是否部署到[k8s]

kubectl get pod -n kube-system -l app=helm

7.用helm示例测试

#创建一个chart范例
helm create helm-chart
#检查chart语法
helm lint ./helm-chart
#使用默认chart部署到k8s
helm install --name example1 ./helm-chart --set service.type=NodePort
#kubectl get pod 查看是否部署成功

相关文章

网友评论

      本文标题:kubernetes包管理工具helm和tiller的安装

      本文链接:https://www.haomeiwen.com/subject/zbstfqtx.html