Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a default value to a kubernetes helm template

If I have a basic kubernetes helm template like below:

port: {{ .Values.Port }}

Is there a way to specify a default port if none is passed in?

like image 442
jjbskir Avatar asked Sep 10 '25 17:09

jjbskir


1 Answers

In values.yaml you put Port: <port-number> which will be used if you don't pass the value using --set.

You can also set default like following

port: {{ default 1234 .Values.Port }}
# You can replace 1234 with your port number
like image 105
hoque Avatar answered Sep 13 '25 16:09

hoque