K8s之helm部署应用

Helm可以用源码或构建的二进制版本安装

#下载 helm二进制文件
wget https://get.helm.sh/helm-v3.5.3-linux-amd64.tar.gz
#解压
tar -zxvf helm-v3.5.3-linux-amd64.tar.gz
# copy /usr/bin
cp helm /usr/bin/
[root@master linux-amd64]# helm
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
- ...
#此时helm安装好了

创建charts

[root@master linux-amd64]# helm create mychart
Creating mychart
[root@master linux-amd64]# ls
LICENSE  mychart  README.md
[root@master linux-amd64]# cd mychart/
[root@master mychart]# ls
charts  Chart.yaml  templates  values.yaml
#修改 templates 里面的内容
[root@master linux-amd64]# helm install web123 mychart/
NAME: web123
LAST DEPLOYED: Fri Mar 12 11:43:42 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@master linux-amd64]# kubectl get pod,svc
NAME                      READY   STATUS    RESTARTS   AGE
pod/web-d86c95cc9-dlnvn   1/1     Running   0          9s

NAME                 TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
service/kubernetes   ClusterIP   10.20.0.1       <none>        443/TCP        43s
service/web          NodePort    10.20.170.134   <none>        80:30358/TCP   9s

上一篇:k8s包管理工具helm - 介绍和安装


下一篇:Helm安装及配置