一 环境
kubernetes 版本:v1.11.2
[root@dev-master-105 helm-2.11.0]# kubectl version
Client Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0-168+f47446a730ca03", GitCommit:"f47446a730ca037473fb3bf0c5abeea648c1ac12", GitTreeState:"clean", BuildDate:"2018-08-25T21:05:52Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0-168+f47446a730ca03", GitCommit:"f47446a730ca037473fb3bf0c5abeea648c1ac12", GitTreeState:"clean", BuildDate:"2018-08-25T21:05:52Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
linux 版本:
[root@dev-master-105 helm-2.11.0]# uname -a
Linux dev-master-105 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
二 安装
获取helm文件
wget https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz
## 解压
tar -zvxf helm-v2.11.0-linux-amd64.tar.gz
[root@dev-master-105 helm]# ls -l
total 18708
-rw-r--r-- 1 root root 19149273 Oct 22 15:20 helm-v2.11.0-linux-amd64.tar.gz
drwxr-xr-x 2 root root 4096 Sep 26 02:17 linux-amd64
##移动二进制文件
[root@dev-master-105 helm]# mv linux-amd64/helm /usr/local/bin/helm
初始化
[root@dev-master-105 test]# helm init
$HELM_HOME has been configured at /root/.helm.
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
To prevent this, run `helm init` with the --tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
查看tiller是否已经起来
[root@dev-master-105 test]# helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
Error: could not find a ready tiller pod
发现没有起来,检查错误
通过kubectl describe pod tiller-deploy-7f4974b9c8-drbs4 -n kube-system
查看,是因为网络的问题
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 11m default-scheduler Successfully assigned kube-system/tiller-deploy-7f4974b9c8-drbs4 to dev-slave-testnet
Normal SandboxChanged 10m kubelet, dev-slave-testnet Pod sandbox changed, it will be killed and re-created.
Warning Failed 8m (x6 over 10m) kubelet, dev-slave-testnet Error: ImagePullBackOff
Normal Pulling 7m (x4 over 11m) kubelet, dev-slave-testnet pulling image "gcr.io/kubernetes-helm/tiller:v2.11.0"
Warning Failed 7m (x4 over 10m) kubelet, dev-slave-testnet Failed to pull image "gcr.io/kubernetes-helm/tiller:v2.11.0": rpc error: code = Unknown desc = Get https://gcr.io/v1/_ping: dial tcp 64.233.187.82:443: i/o timeout
Normal BackOff 6m (x9 over 10m) kubelet, dev-slave-testnet Back-off pulling image "gcr.io/kubernetes-helm/tiller:v2.11.0"
Warning Failed 1m (x6 over 10m) kubelet, dev-slave-testnet Error: ErrImagePull
解决办法1.helm reset
需要指定镜像
helm init -i 990570827/tiller:v2.11.0
如果之前部署不成功,那么就得修改之前的deployment
查看状态
[root@dev-master-105 test]#
[root@dev-master-105 test]# kubectl get pods -n kube-system -owide | grep tiller-deploy
tiller-deploy-5849c585c7-8xqnn 1/1 Running 0 32s 192.168.72.23 dev-slave-testnet
出现问题
[root@dev-master-105 test]# helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
E1022 16:27:57.047815 28426 portforward.go:331] an error occurred forwarding 33023 -> 44134: error forwarding port 44134 to pod 612a0e878789aa021c80b3d2f7e7514fba75c908a0da285205c13c06b5605c02, uid : unable to do port forwarding: socat not found.
Error: cannot connect to Tiller
解决办法 安装
yum install socat -y
问题解决
[root@dev-master-105 test]# helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
测试
helm install stable/mariadb
[root@dev-master-105 ~]# helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
sad-greyhound 1 Mon Dec 4 17:16:27 2017 DEPLOYED mysql-0.3.0 default
solitary-hedgehog 1 Mon Oct 22 17:07:12 2018 DEPLOYED mariadb-2.0.0 10.1.28 default
wwwwddd 1 Wed Dec 6 14:28:01 2017 DEPLOYED wordpress-0.6.13 default
另一种安装方式是直接通过脚本安装
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
参考:
官方文档
helm 部署
中文文档