|NO.Z.00021|——————————|CloudNative|——|Kubernetes&RBAC介绍.V04|——|helm-chart|

一、helm:自己创建chart,完成应用部署
二、通过helm创建chart
### --- 使用命令创建chart
~~~		命令格式:helm create chart 名称

[root@k8s-master ~]# helm create mychart
Creating mychart
### --- 可以查看到生成的模板
~~~		charts: 空文件,不需要写入东西 
~~~		Chart.yaml:当前chart属性配置信息
~~~		templates:编写yaml文件放到这个目录中,里面很多的yaml文件,把自己写的yaml文件放在yaml中即可
~~~		values.yaml:yaml文件可以使用全局变量,全局变量的配置,可以放在values.yaml中,把自己定义的全局变量写入到该目录中

[root@k8s-master ~]# cd mychart/
[root@k8s-master mychart]# ls   
### --- 在templates文件夹创建两个yaml文件

[root@k8s-master ~]# cd mychart/templates/
[root@k8s-master templates]# kubectl create deployment web1 --image=nginx --dry-run -o yaml > deployment.yaml
W0223 20:46:15.517209   85463 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client.
[root@k8s-master templates]# kubectl expose deployment web1 --port=80 --target-port=80 --type=NodePort --dry-run -o yaml > service.yaml
W0223 20:49:55.929965   86337 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client.
[root@k8s-master templates]# kubectl create deployment web1 --image=nginx
deployment.apps/web1 created

[root@k8s-master templates]# kubectl get pods
web1-7f87dfbd56-5ffjz                           0/1     ContainerCreating   0 
[root@k8s-master templates]# kubectl delete deployment web1
deployment.apps "web1" deleted
~~~		查看删除状态,待会就查看不到了
[root@k8s-master templates]# kubectl get pods 

~~~		查看创建的两个yaml文件
[root@k8s-master templates]# ls
deployment.yaml  service.yaml
### --- 安装mychart:输出说明安装成功

[root@k8s-master ~]# helm install web1 mychart/             
NAME: web1
LAST DEPLOYED: Tue Feb 23 20:53:22 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
[root@k8s-master ~]# kubectl get pods
web1-7f87dfbd56-4fd9d                           1/1     Running     0          34s

[root@k8s-master ~]# kubectl get svc
web1             NodePort    10.105.189.14   <none>        80:31037/TCP   50s
### --- 应用升级更新

[root@k8s-master ~]# helm upgrade web1 mychart/
Release "web1" has been upgraded. Happy Helming!
NAME: web1
LAST DEPLOYED: Tue Feb 23 20:56:27 2021
NAMESPACE: default
STATUS: deployed
REVISION: 2
TEST SUITE: None  

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(27)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示