helm常用命令

一、helm常用命令

1、查看帮助

helm help

2、创建一个chart包模板

格式:
helm create [releasename]
例子:

$helm create hello-world #会创建一个目录结构看起来像这样:
hello-world/
├──.helmignore#ContainspatternstoignorewhenpackagingHelmcharts.
├──Chart.yaml#Informationaboutyourchart
├──values.yaml#Thedefaultvaluesforyourtemplates
├──charts/#Chartsthatthischartdependson
└──templates/#Thetemplatefiles
└──tests/#Thetestfiles

3、打包前检查、测试charts语法

格式:
helm lint [releasename]

4、打包chart包

格式:
helm package [servicename]

5、安装一个chart应用

格式:
helm install {chartpackagename/charts.tgz} --name {name} --namespace {namespace}
chartpackagename为chart包名,chart可以是未打包的chart,也可以是打包的chart,也可以是仓库中的chart。
例子:

helm upgrade mysql --name template --namespace republic

# 生成的资源(比如Ingress、Service、Deployment等等)将会以hello-world-为前缀
helm install hello-world "incubator/haproxy-ingress"
# 安装特定版本                                 
helm install hello-world "incubator/haproxy-ingress" --version "v1.1.2"               
                                                
# 并从本地直接安装
helm install hello-world "hello-world-6.3.3.tgz"                                              

helm pull:     下载 chart 到本地目录查看
# 指定参数
helm install hello-world "incubator/haproxy-ingress" --set scName=xxxxxxx    
# 通过文件指定参数         
helm install hello-world "incubator/haproxy-ingress" -f /path/to/values.yaml          

6、更新一个chart应用

格式:
helm upgrade [releasename] [chart] [flags]
例子:

helm upgrade mysql mysql --namespace republic

7、查看部署的release的所有资源信息

格式:
helm status [releasename]

8、获取部署的release的所有manifest文件

格式:
helm get [releasename] -n {namespace}

9、删除部署的release

格式:
helm delete [releasename] -n {namespace}

10、查看已经部署的release

格式:
helm list -n {namespace}
例子:

# helm -n kube-storage-nfs list 
NAME     NAMESPACE          REVISION   UPDATED                                 STATUS     CHART                                   APP VERSION
nfs-sc   kube-storage-nfs   1          2022-04-18 02:19:20.142099667 +0000 UTC deployed   nfs-subdir-external-provisioner-4.0.16  4.0.2 

11、查看历史release

格式:
helm history [releasename] [flags] -n {namespace}
例子:

[root@k8s-master hello-world]# helm history hello-world
REVISION    UPDATED                     STATUS        CHART                APP VERSION    DESCRIPTION     
1           Sat Sep 18 14:21:13 2021    superseded    hello-world-1.0.0                   Install complete
2           Sat Sep 18 14:44:06 2021    deployed      hello-world-1.0.0                   Upgrade complete

12、回退到历史版本

格式:
helm rollback [releasename] [REVISION] [flags] -n {namespace}
例子:

[root@k8s-master hello-world]# helm rollback hello-world 1
Rollback was a success! Happy Helming!

13、下载 chart 到本地目录查看

helm pull

14、搜索 chart

helm search

二、helm仓库

1、添加 chart 仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
2、列出已添加的仓库
helm repo list
3、从 chart 仓库中更新本地可用 chart 的信息
helm repo update bitnami
4、删除一个或多个仓库
helm repo remove bitnami

参考:
https://www.elecfans.com/d/1892810.html

posted @ 2023-01-25 00:34  cavan丶keke  阅读(1450)  评论(0编辑  收藏  举报