[root@web-test-01 ~]
wget https://get.helm.sh/helm-v3.1.2-linux-amd64.tar.gz
tar zxvf helm-v3.1.2-linux-amd64.tar.gz
cd linux-amd64
cp helm /usr/bin/helm
helm version
version.BuildInfo{Version:"v3.1.2", GitCommit:"d878d4d45863e42fd5cff6743294a11d28a9abce", GitTreeState:"clean", GoVersion:"go1.13.8"}
[root@192 demo]# helm help
The Kubernetes package manager
Common actions for Helm:
- helm search: search for charts
- helm pull: download a chart to your local directory to view
- helm install: upload the chart to Kubernetes
- helm list: list releases of charts
# 生成chart文件
[root@192 ~]# helm create one
Creating one
# 打包
[root@192 ~]# helm package one
Successfully packaged chart and saved it to: /root/one-0.1.0.tgz
[root@192 ~]#
# 安装
[root@192 ~]# helm install one one-0.1.0.tgz
NAME: one
LAST DEPLOYED: Mon Jun 22 12:06:40 2020
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}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace default port-forward $POD_NAME 8080:80
[root@192 ~]# helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
one default 1 2020-06-22 12:06:40.103299546 +0800 CST deployed one-0.1.0 1.16.0
[root@192 ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 23d
one ClusterIP 10.97.179.118 <none> 80/TCP 117s
[root@192 ~]# kubectl get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
one 1/1 1 1 2m4s
[root@192 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
one-656864586b-ldsw2 1/1 Running 0 2m8s
tomcat-daemonset-t6tcq 1/1 Running 1 15h
#删除刚才安装的release
[root@192 ~]# helm delete one
release "one" uninstalled
[root@192 ~]# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 23d
[root@192 ~]# kubectl get deploy
No resources found in default namespace.
[root@192 ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
tomcat-daemonset-t6tcq 1/1 Running 1 16h
[root@192 ~]#
repo的操作:
# 添加仓库
$helm repo add {仓库名字} {仓库地址}
"{仓库名字}" has been added to your repositories
# 查询仓库列表
$helm repo list
NAME URL
{仓库名字} {仓库地址}
# 查询chart包
$helm search repo
# 删除仓库
$helm repo remove {仓库名字}
"{仓库名字}" has been removed from your repositories