参考:https://kubernetes.io/zh-cn/docs/home
安装helm客户端
# https://kubernetes.io/docs/tasks/tools/install-kubectl-linux
# debian
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
apt-get install -y apt-transport-https
echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
apt-get update
apt-get install -y helm
# rel
# This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.28/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.28/rpm/repodata/repomd.xml.key
EOF
yum install -y kubectl
# windows
# Set-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
# 安装choco包管理工具
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# 查看choco版本
choco -v
# 安装helm命令
choco install kubernetes-helm
# 查看helm版本
helm version
# 帮助命令
helm -h
# helm [command] -h
仓库管理
# 添加helm仓库(示例)
helm repo add bitnami https://charts.bitnami.com/bitnami # 常用
helm repo add azure http://mirror.azure.cn/kubernetes/charts # 常用
helm repo add jetstack https://charts.jetstack.io
helm repo add emqx https://repos.emqx.io/charts
helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm repo add jetstack https://charts.jetstack.io
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
# 查看仓库
helm repo list
Charts包管理
# 查看Charts包
helm search repo nginx
# 拉取Chart包
helm pull bitnami/nginx
# 创建本地Chart包
helm create my-chart
# 部署应用
helm install nginx my-chart -n default
helm install nginx bitnami/nginx -n default
helm upgrade -i nginx --set image.imageName=nginx --set image.tag=2.0.0 -n default # 如果没有部署则部署,如果已经部署则更新
# 查看历史版本
helm history nginx -n default
# 回滚版本到指定版本
helm rollback nginx 1 -n default # 1为helm的版本,并非deployment的版本
# 卸载
helm uninstall nginx -n default