版本说明

helm:v2.14.3

一、helm 相关命令

1、查看 chart 仓库 Harbor

1
helm repo list

2、更新chart仓库

1
helm repo update

3、创建 chart 相关文件集

1
helm create $chartName

4、检查 chart 语法是否合格

1
2
3
helm lint $chartName
# 或者
helm install wechart --dry-run --debug

5、推送 chart 到 Harbor 仓库

1
helm push $chartName https://$ip:443/chartrepo/$repoName --username=admin --password=admin --ca-file /etc/docker/certs.d/$ip:443/ca.crt

6、在当前仓库中查询 chart 是否存在

1
2
3
4
# helm2
helm search $chartName
# helm3
helm search repo $chartName

7、从 Harbor 仓库中下载 chart

1
helm fetch $repoName/$chartName

下载下来的是一个 tgz 包,可用 tar zxvf xxx.tgz 命令解压。

8、chart 包离线部署与卸载(helm 2 和 helm 3 的命令都在这里)

1
2
3
4
5
6
7
8
9
10
11
12
# helm2 安装。
helm install $chartDirName --name $releaseName --namespace $namespaceName

# 卸载
helm del --purge $releaseName

# helm3 安装。
# releaseName为Release名称;namespaceName为命名空间;chartDirName是chart目录文件夹
helm install $releaseName -n $namespaceName $chartDirName

# 卸载
helm uninstall $releaseName -n $namespaceName

如果是线上部署,则指定 chart 仓库名与 chart 名代替 $chartDirName 即可,比如:cloud-product/wechart

9、查看 chart 包部署历史

1
2
# releaseName为已部署的实例名,helm list的那个名字
helm history $releaseName

10、查看部署 chart 的 release 实例列表

chart 部署时,需要指定 release 实例名称。我们可以通过命令获取到 k8s 集群中所有的 release 列表。

1
helm list

11、查看 service、deploy、pod、ingress 等状态

在 helm 2 中,可以通过下面的命令来查看 service、deploy、pod、ingress 等状态

1
helm status $releaseName

在 helm 3 中,可以通过下面的命令来查看 service、deploy、pod、ingress 等状态

1
kubectl get svc,deploy,pod,ing,cm -n public -lrelease=holli-cloud-gateway