helm本地debug template渲染小记

前提条件
1, 安装helm
2,要能连接的k8s
3,本地有完成charts文件目录

具体步骤

本文因为是在项目流程中helm渲染出的deployment语法报错或者最终生成的不符合预期,因此本地使用helm命令进行debug验证测试。

我们先看一下基本的charts目录结构
在这里插入图片描述

在本地调试,所有命令都添加了 --debug --dry-run 这两个参数

-dry-run simulate an install

1, --set 设置value

在使用helm命令渲染的时候,默认是读取了values.yaml
如果我们需要覆盖values.yaml中定义的值,可以在helm的参数中指定–set image.tag=v1.1

官方文档的解释:
–set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)

helm upgrade --namespace mytest --install  --debug --dry-run  goodly-guppy  ./template-charts --set image.imageName=abc  --set image.tag=v1.1  

2, --values 指定新的values文件

可以指定新的values文件,文件名称不一定使用values.yaml
–values ./template-charts/custom.values.yaml

–values strings specify values in a YAML file or a URL (can specify multiple)

–values (or -f): Specify a YAML file with overrides. This can be specified multiple times and the rightmost file will take precedence

可以指定多个values文件, 最右边的优先级高

ou can specify the ‘–values’/‘-f’ flag multiple times. The priority will be given to the last (right-most) file specified. For example, if both myvalues.yaml and override.yaml contained a key called ‘Test’, the value set in override.yaml would take precedence:

$ helm install -f myvalues.yaml -f override.yaml myredis ./redis
https://helm.sh/docs/helm/helm_install/#synopsis

在这里插入图片描述

helm upgrade --namespace mytest --install  --debug --dry-run  goodly-guppy  ./template-charts --set image.imageName=abc  --set image.tag=v1.1  --values  ./template-charts/custom.values.yaml
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值