K8S学习之基础六十三:自定义chart模板部署nginx

自定义chart模板部署nginx

创建chart
helm create myapp

在这里插入图片描述
在这里插入图片描述

tree ./
./
├── charts   #用于存放所依赖的子chart
├── Chart.yaml  # 描述这个 Chart 的相关信息、包括名字、描述信息、版本等

├── templates  #模板目录,保留创建k8s的资源清单文件
│   ├── deployment.yaml  #deployment资源的go模板文件
│   ├── _helpers.tpl  # #模板助手文件,定义的值可在模板中使用

│   ├── hpa.yaml #水平pod自动扩缩容go模板文件
│   ├── ingress.yaml  #七层代理go模板文件
│   ├── NOTES.txt
│   ├── serviceaccount.yaml
│   ├── service.yaml  #service的go模板文件
│   └── tests
│       └── test-connection.yaml
└── values.yaml   #模板的值文件,这些值会在安装时应用到 GO 模板生成部署文件

helm v3版本对应的Chart版本是 v2
在这里插入图片描述

[root@mast01 myapp]# more Chart.yaml 
apiVersion: v2             # chart版本
name: myapp              # chart名字
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application            # 可部署类型

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"             # 镜像标签
apiVersion: 这指定了Helm Chart的API版本,这里使用的是v2版本。在 v2 版本的 Helm 中,apiVersion 是 v1,而在 v3 版本的 Helm 中,apiVersion 升级为 v2。
name: 指定Chart的名称,这个名称将用于在Helm中引用这个Chart。
description: 这是对Chart的描述,用于说明这个Chart是做什么的。
type: 这指定Chart的类型,可以是'application'(应用程序)或'library'(库)。在这个示例中,类型为'application',意味着这是一个可以部署的应用程序Chart。
version: 这是Chart的版本号。每当对Chart和其模板(templates)进行更改时,包括应用版本,都应该递增这个版本号。版本号遵循语义化版本(Semantic Versioning)规范。
appVersion: 指的是镜像标签的版本号

修改values.yaml中镜像信息
在这里插入图片描述
部署myapp

helm instll nginx ./
kubectl get pods
kubectl get svc
curl 10.101.20.251

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值