一个实际的项目

选取了一个实际项目,分析下几方面

  • 资源类型有哪些

  • 提取了哪些变量

  • 常用的几个语法

准备工作

接入一个实际项目,拉取并解压出来一个Helm Chart

helm repo add ml-platform http://harbor-v2.mobvista.com/chartrepo/ml-platform
helm pull ml-platform/predict --untar

看看里面有什么

$ tree predict
predict
├── Chart.yaml
├── README.md
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
│   ├── autoscaling.yaml
│   ├── configmap.yaml
│   ├── deployment.yaml
│   ├── ingress.yaml
│   ├── pdb.yaml
│   ├── service-monitor.yaml
│   ├── service.yaml
│   ├── serviceaccount.yaml
│   └── tests
│       └── test-connection.yaml
└── values.yaml

挨个看看模版内容,可以拿来参考改造其他项目

helm template predict 可以查看模版渲染之后的yaml内容

deployment.yaml

configmap.yaml

autoscaling.yaml

pdb.yaml

service.yaml

ingress.yaml

serviceaccount.yaml

service-monitor.yaml

Values.yaml

Chart.yaml

_helpers.tpl

出现的几个常用语法

template

渲染后

看一下官方描述

include

用这个例子说明下

渲染出来是错误的

helm install --dry-run mychart ./mychart

dry-run方法可以校验正确与否

最后更新于

这有帮助吗?