DEV Community

Carlos Nogueira
Carlos Nogueira

Posted on • Updated on

Converting Helm Charts to K8S SDK Templates

If you are working on a helm chart, however, you need to make customizations or debug in a more native way. An alternative is to convert it to kubernetes SDK templates.

Requirements

  • Kubernetes(1.16+)
  • helm (3+)
  • kubectl(1.16+)

The process is simple:
(mongodb example)

1 Install desired chart generic release

- $ kubectl create ns mgodb-ns
- $ helm install mongodb --namespace mgodb-ns stable/mongodb
Enter fullscreen mode Exit fullscreen mode

2 Extract default generated chart values from the release

- $ helm get values mongodb -a --output yaml > values.yaml 
Enter fullscreen mode Exit fullscreen mode

3 Convert the chart to template

- $ helm template --values ./values.yaml --output-dir \
./manifests stable/mongodb

OUTPUT: 
wrote ./manifests/mongodb/templates/secrets.yaml
wrote ./manifests/mongodb/templates/pvc-standalone.yaml
wrote ./manifests/mongodb/templates/svc-standalone.yaml
wrote ./manifests/mongodb/templates/deployment-standalone.yaml
Enter fullscreen mode Exit fullscreen mode

Now you can work on native SDK k8s yamls at the directory manifests/mongodb/templates/

4 Don't forget to delete the generic release

- $ helm uninstall mongodb
- $ kubectl delete ns mgodb-ns
Enter fullscreen mode Exit fullscreen mode

Top comments (0)