Helm 使用总结

283 阅读1分钟

添加仓库 artifacthub.io/ 可以找相关的chart

helm3 没有默认的存储仓库 需要配置仓库

使用Artifact Hub来查找他们要查找的内容,然后添加他们首选的存储库

微软仓库(mirror.azure.cn/kubernetes/…

阿里云仓库(kubernetes.oss-cn-hangzhou.aliyuncs.com/charts

Bitnami库 charts.bitnami.com/bitnami

官方仓库(hub.kubeapps.com/charts/incu…

命令各式:
helm repo list
helm repo add 【自定义仓库名称】【仓库地址】
helm repo update | remove 【自定义仓库名称】【仓库地址】

# 添加仓库
helm repo add stable http://mirror.azure.cn/kubernetes/charts
helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
helm repo add my-repo https://charts.bitnami.com/bitnami
# 列出仓库
helm repo list

# 更新删除 仓库
helm repo update aliyun 
helm repo remove aliyun 

Helm 基本命令使用

查询 chart

helm search repo 【chart名称】
helm search repo redis  显示最新的版本
helm search repo redis --versions   显示所有版本

安装 chart

helm install 【自定义名称】【仓库名称】/【chart名称】
helm install my-nginx my-repo/nginx

# 可携带参数
helm install --namespace 【k8s中的名字空间】
helm install --namespace mybase  my-nginx my-repo/nginx

# 可自定一些配置 使用--set
helm install my-nginx --set service.type=NodePort my-repo/nginx

# 尝试安装 --dry-run 不会真正安装到k8s中 但会输出deplayment.yml service.yml
helm install my-nginx --set service.type=NodePort  my-repo/nginx --dry-run

升级安装 当想修改某个配置的时候

例如安装时的配置
helm install my-nginx  my-repo/nginx --set service.ports.http=8181
修改端口为80
helm upgrade my-nginx  my-repo/nginx --set service.ports.http=80

卸载安装的 chart

helm uninstall 【安装时指定的名称】
helm uninstall my-nginx
#卸载指定命名空间下的chart
helm uninstall my-nginx --namespace  mybase