Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy only one template from the helm chart

Is there a way to deploy one template from the helm chart? helm upgrade --install has to be applied to the chart, but I want to deploy only one file, lets say configmap.yaml. When I run kubectl apply -f configmap.yaml, I get an error: error converting YAML to JSON: yaml: line 5: did not find expected node content because there are variables fetched from _helpers.tpl: {{ include "templatename.fullname" . }}. Using helm 3.

like image 748
Olga Avatar asked May 09 '26 10:05

Olga


2 Answers

you could try this command:

helm template -s templates/configmap.yaml . | kubectl apply -f -
like image 56
xy kong Avatar answered May 11 '26 16:05

xy kong


Found I can do it this way:

In config.yaml:

...
labels:
  my-label: abc

Then use the -l filter option of kubectl to choose only those objects that have this label.

helm template name charts/chartname/charts/name --values values.yaml | kubectl apply -f - -l my-label=abc
like image 25
Olga Avatar answered May 11 '26 15:05

Olga