Helm 应用管理部署

Kubernetes 包管理器
简介:

官网

https://helm.sh/zh/docs
https://www.qikqiak.com/k8strain2/helm
https://github.com/helm/helm/releases

应用中心

https://artifacthub.io

helm ui管理

https://kubeapps.com

二进制部署
https://helm.sh/zh/docs/intro/quickstart
https://github.com/helm/helm/releases

wget https://get.helm.sh/helm-v3.6.0-linux-amd64.tar.gz tar xf helm-v3.6.0-linux-amd64.tar.gz mv linux-amd64/helm /usr/local/bin/ 

本地脚本直接部署

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 chmod 700 get_helm.sh ./get_helm.sh 

直接运行安装

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash 

命令行自动补全

1、临时生效

source <(helm completion bash) 

2、写配置文件

echo source <(helm completion bash) >>  ~/.bash_profile  

3、bash-completion添加配置

helm completion bash > /usr/share/bash-completion/completions/helm 

4、添加helm仓库

helm repo add bitnami https://charts.bitnami.com/bitnami 

5、查看所有仓库

[root@master ~]# helm repo list WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config NAME            URL rancher-latest  https://releases.rancher.com/server-charts/latest jetstack        https://charts.jetstack.io bitnami         https://charts.bitnami.com/bitnami  

6、更新仓库

[root@master ~]# helm repo update WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the jetstack chart repository ...Successfully got an update from the rancher-latest chart repository ...Successfully got an update from the bitnami chart repository Update Complete. ⎈Happy Helming!⎈ [root@master ~]# 

7、查询

[root@master ~]# helm search repo stable/mysql WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config NAME                    CHART VERSION   APP VERSION     DESCRIPTION stable/mysql            1.6.8           5.7.30          Fast, reliable, scalable, and easy to use open-... stable/mysqldump        2.6.2           2.4.1           DEPRECATED! - A Helm chart to help backup MySQL... [root@master ~]# [root@master ~]# helm search repo stable/mysql -l WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config NAME                    CHART VERSION   APP VERSION     DESCRIPTION stable/mysql            1.6.8           5.7.30          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.7           5.7.30          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.6           5.7.30          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.5           5.7.30          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.4           5.7.30          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.3           5.7.28          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.2           5.7.28          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.1           5.7.27          Fast, reliable, scalable, and easy to use open-... stable/mysql            1.6.0           5.7.27          Fast, reliable, scalable, and easy to use open-... 

8、helm chart包结构

[root@master ~]# helm create test WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config [root@master ~]# cd test/ [root@master test]# [root@master test]# ls -l total 8 drwxr-xr-x 1 root root  512 May 29 10:09 charts -rw-r--r-- 1 root root 1140 May 29 10:09 Chart.yaml drwxr-xr-x 1 root root  512 May 29 10:09 templates -rw-r--r-- 1 root root 1871 May 29 10:09 values.yaml 

9、helm插件安装

[root@master ~]# helm plugin install https://github.com/chartmuseum/helm-push WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config Downloading and installing helm-push v0.9.0 ... https://github.com/chartmuseum/helm-push/releases/download/v0.9.0/helm-push_0.9.0_linux_amd64.tar.gz Installed plugin: push [root@master ~]# helm plugin list WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config NAME    VERSION DESCRIPTION push    0.9.0   Push chart package to ChartMuseum [root@master ~]# 

10、Helm使用时关于kubernetes文件的警告

[root@master kafka]# helm ls WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /root/.kube/config WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /root/.kube/config NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION [root@master kafka]# ls -l /root/.kube/config -rwxrwxrwx 1 root root 5399 Aug  2 15:25 /root/.kube/config [root@master kafka]# chmod g-rw ~/.kube/config [root@master kafka]# chmod o-r ~/.kube/config [root@master kafka]# helm ls NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION [root@master kafka]#