helm简介
官网文档:https://helm.sh/
helm是kubernetes的包管理器,类似于linux系统下的apt-get或yum
安装
wget https://get.helm.sh/helm-v2.12.3-linux-amd64.tar.gz
cp helm tiller /usr/local/bin helm version tiller -version 安装初始化: kubectl apply -f install/kubernetes/helm/helm-service-account.yaml [root@k8s-master ~]# helm init --service-account tiller --skip-refresh #helm init --upgrade -i registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.11.0 --stable-repo-url https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts 查看 #kubectl get pod -n kube-system -l app=helm [root@k8s-master linux-amd64]# kubectl get pod -n kube-system -l app=helm NAME READY STATUS RESTARTS AGE tiller-deploy-7df745645f-ptzwj 1/1 Running 0 5m22s [root@k8s-master linux-amd64]# 验证: [root@k8s-master ~]# helm version Client: &version.Version{SemVer:"v2.12.3", GitCommit:"eecf22f77df5f65c823aacd2dbd30ae6c65f186e", GitTreeState:"clean"} Server: &version.Version{SemVer:"v2.12.3", GitCommit:"eecf22f77df5f65c823aacd2dbd30ae6c65f186e", GitTreeState:"clean"} [root@k8s-master ~]#
helm安装gitlab插件
插件地址:https://github.com/diwakar-s-maurya/helm-git
用户根据公司业务需求,制作适用于自己的helm模板
[root@k8s-master ~]# helm plugin install https://github.com/technosophos/helm-template [root@k8s-master ~]# helm plugin install helm-git Installed plugin: helm-git [root@k8s-master ~]# helm plugin list NAME VERSION DESCRIPTION helm-git 1.0.0 Let's you use private gitlab repositories easily template 2.5.1+2 Render templates on the local client. [root@k8s-master ~]# [root@k8s-node1 helm-git]# helm repo list NAME URL stable https://kubernetes-charts.storage.googleapis.com local http://127.0.0.1:8879/charts jiatui gitlab://devops/service-config-k8s:master/helm-jtsys [root@k8s-node1 helm-git]# helm plugin remove helm-git helm plugin install helm-git
添加helm仓库
[root@k8s-master ~]# helm repo list NAME URL stable https://kubernetes-charts.storage.googleapis.com local http://127.0.0.1:8879/charts [root@k8s-master ~]# helm repo add jiatui gitlab://devops/service-config-k8s:master/helm-jtsys Username for 'https://arch-git.jiatuiyun.net': root Password for 'https://root@arch-git.jiatuiyun.net': "jiatui" has been added to your repositories [root@k8s-master ~]# helm repo list NAME URL stable https://kubernetes-charts.storage.googleapis.com local http://127.0.0.1:8879/charts jiatui gitlab://devops/service-config-k8s:master/helm-jtsys [root@k8s-master ~]#
安装应用
安装: helm install --name company jiatui/jtsys --debug --dry-run -f service-config-k8s/values.yaml/test-company-value.yaml 更新: helm upgrade architect jiatui/jtsys --debug -f service-config-k8s/values.yaml/test-company-value.yaml 动态扩展 kubectl get deploy -n company --no-headers | awk '{cmd="sleep 10;kubectl -n company scale --replicas=0 deploy/"$1;system(cmd)}'
helm模板
未完......