helm 3.5.2 安装
官方文档
https://helm.sh/docs/intro/install/
下载安装包
wget https://get.helm.sh/helm-v3.5.2-linux-amd64.tar.gz
tar zxvf helm-v3.5.2-linux-amd64.tar.gz
cd linux-amd64/
cp helm /usr/bin/helm
查看版本
helm version
version.BuildInfo{Version:"v3.5.2", GitCommit:"167aac70832d3a384f65f9745335e9fb40169dc2", GitTreeState:"dirty", GoVersion:"go1.15.7"}
添加共有仓库
helm repo add stable http://mirror.azure.cn/kubernetes/charts helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts helm repo update
指定k8s集群位置
export KUBECONFIG=/root/.kube/config
简单测试
# 生成chart文件
[root@master01 linux-amd64]# helm create one
Creating one
# 打包
[root@master01 linux-amd64]# helm package one
Successfully packaged chart and saved it to: /root/config/helm/linux-amd64/one-0.1.0.tgz
# 安装
[root@master01 linux-amd64]# helm install one one-0.1.0.tgz
NAME: one
LAST DEPLOYED: Tue Mar 2 13:50:05 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=one,app.kubernetes.io/instance=one" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace default $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace default port-forward $POD_NAME 8080:$CONTAINER_PORT
[root@master01 linux-amd64]# helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
one default 1 2021-03-02 13:50:05.926498934 +0800 CST deployed one-0.1.0 1.16.0
[root@master01 linux-amd64]# kubectl get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
nfs-client-provisioner 1/1 1 1 11d
one 1/1 1 1 15m
[root@master01 linux-amd64]# helm delete one
release "one" uninstalled
[root@master01 linux-amd64]# helm repo list
NAME URL
stable http://mirror.azure.cn/kubernetes/charts
aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts