HELM 是k8的包管理工具 ,像linux系统的包管理器,如yum,apt等,很方便的把yaml 文件部署到k8s上面!

第一部: 安装篇

1.helm包下载地址:https://get.helm.sh/helm-v3.6.1-linux-amd64.tar.gz

 2.解压 && 移动到 /usr/bin 目录下: tar -xvf helm-v3.6.0-rc.1-linux-amd64.tar.gz && cd linux-amd64/ && mv helm /usr/bin 

3.执行 helm 显示如下说明安装成功:

 

第二部:配置仓库篇

helm repo add apphub https://apphub.aliyuncs.com    ##  apphub #仓库名  https://apphub.aliyuncs.com # 仓库地址

helm repo list # 查看仓库

helm repo update # 更新仓库 

helm repo remove  baidu # 删除仓库

第三部: HELM 部署应用

helm search repo  nginx -l # 搜索应用 nginx,并查看历史版本

helm search repo filebeat --versions  #搜索可用的版本

helm  install   xnginx  nginx #  安装应用 xnginx #安装新的应用名称 nginx # 原来的应用名称

helm install nginx aliyuncs/nginx  --version 1.21  --set service.type=NodePort --set persistence.enabled=false                        #指定版本安装对外暴露端口方式为 NodePort 默认为 LoadBanlancer          # 不启用持久化存储,1.21版本是chart版本号

helm uninstall   xnginx #  卸载应用

helm list  # 应用的状态

helm status nginx # =nginx 的信息

helm get all  xnginx : # 获取 xnginx的详细配置信息

第四部:报错排查

如果有报错,有些旧仓库往会最新版 K8S,这里是 v1.18.2按照,会报错,可以换个仓库或者下载下来修改后本地安装

报错
Error: unable to build kubernetes objects from release manifest: unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1"
helm pull apphub/nginx-ingress --untar
grep -irl "extensions/v1beta1" nginx-ingress | grep -ir deployment
grep -irl "extensions/v1beta1" nginx-ingress | grep -ir deploy | xargs sed -i 's#extensions/v1beta1#apps/v1#g'
helm install nginx1 ./nginx-ingress/
第五部分:helm 自动补全命令
source <(helm completion bash)

echo "source <(helm completion bash)" >> ~/.bashrc
source /usr/share/bash-completion/bash_completion

#先添加常用的chart源

http://mirror.azure.cn/kubernetes/charts-incubator/
http://mirror.azure.cn/kubernetes/charts/
helm repo add stable https://charts.helm.sh/stable
helm repo add incubator https://charts.helm.sh/incubator
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add aliyuncs https://apphub.aliyuncs.com
#filebeat源
helm repo add filebeat https://helm.elastic.co

posted on 2021-05-24 13:47  MhaiM  阅读(1793)  评论(0编辑  收藏  举报