美文网首页
kubernetes笔记-Helm

kubernetes笔记-Helm

作者: 潘猛_9f76 | 来源:发表于2019-06-03 16:28 被阅读0次
项目首页

https://github.com/helm/helm
先安装helm client、使用helm client安装tiller,通过tiller下载chart,使用chart部署应用
helm clien---> helm tiller (chart) ---> apiserver

安装helm client

下载安装脚本

wget  https://raw.githubusercontent.com/helm/helm/master/scripts/get 

设置上网代理

export http_proxy=http://192.168.124.25:8118/ 
export https_proxy=http://192.168.124.25:8118/ 

运行安装脚本

sh get
Downloading https://kubernetes-helm.storage.googleapis.com/helm-v2.14.0-linux-amd64.tar.gz
Preparing to install helm and tiller into /usr/local/bin
helm installed into /usr/local/bin/helm
tiller installed into /usr/local/bin/tiller
Run 'helm init' to configure helm.
设置环境变量

将/usr/local/bin加入到.bash_profile中PATH环境变量的配置中,并增加helm的命令的补全

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/usr/local/bin
export PATH
source <(kubectl completion bash)
source <(helm completion bash)
安装helm tiller

Helm init 安装tiller服务器

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

Tiller也是容器化安装,会在kubenetes的kube-system namespace中增加service、deployment、pod等资源

kubectl get pods --all-namespaces | grep till
kube-system     tiller-deploy-765dcb8745-4q4hm             1/1     Running             0          8m48s

删除代理

unset http_proxy
unset https_proxy
验证安装成功

当pod变为Running状态后,可以使用helm version确认服务器正常

验证search功能

Helm是k8s的包管理器,类似yum、apt等,chart是一个应用的信息集合(相当于rpm包),而release是chart的运行实例。Helm search可以查看当前可以安装的chart

Helm与yum类似,也有仓库,上面看到的包属于默认的仓库,可以使用helm repo list查看

权限设置

此时tiller还没有集群权限,需要给tiller服务器添加权限
创建serviceaccount资源tiller,属于kube-system命名空间

kubectl create serviceaccount -n kube-system tiller

创建 clusterrolebinding资源tiller-cluster-rule,集群角色为cluster-admin,用户为kube-system:tiller

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

修改deployment tiller-deploy的配置,增加字段spec.template.spec.serviceAccount

kubectl patch deploy -n kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

相关文章

网友评论

      本文标题:kubernetes笔记-Helm

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