Why do I get an empty file?

5/11/2020

I am trying to generate a template from helm chart and want to save the result into a file:

helm template dashboard -n dev --set image.tag=0.1.0 ./dashboard > ./test.yml  

but I've got an empty file.

Runnning without to put the result into the file:

helm template dashboard -n dev --set image.tag=0.1.0 ./dashboard   

---
# Source: dashboard/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: dashboard
  labels:
    helm.sh/chart: dashboard-0.1.0
    app.kubernetes.io/name: dashboard
    app.kubernetes.io/instance: dashboard
    app.kubernetes.io/version: "1.17.5"
    app.kubernetes.io/managed-by: Helm
spec:

As you can see, it generates the output.

What am I doing wrong?

-- zero_coding
kubernetes
kubernetes-helm

2 Answers

5/11/2020

You need to specify an output directory, otherwise it will template to stdout

helm template dashboard -n dev --set image.tag=0.1.0 ./dashboard --output-dir ./dashboard-hydrated

-- truncj
Source: StackOverflow

5/11/2020

You also can use:

helm install dashboard -n dev --set image.tag=0.1.0 ./dashboard --dry-run --debug > your-output.yaml

The --dry-run will not deploy your helm chart directly.

-- irvifa
Source: StackOverflow