0
votes

I am new to helm and liked the idea of helm to create versions for the deployments and package them as artifact in jfrog articatory but one thing that I am unclear about is easiness of creating it.

I am comfortable with kubernetes mainfest and creating it is very simple where you don't have to handcraft a yaml.

You can simply run kubectl command in dry-run mode and export most of the yaml tags as below:

kubectl run nginx --image=nginx --dry-run=client -o yaml > nginx-manifest.yaml

Now for creating helm, I need to run helm create and key in all the values needed by helm yaml files.

Curious if helm has such shortcuts that kubectl provides to create charts easily which keys in required value through command line while generating charts?

Also is there a migration utility available that supports converting the deployment manifest to helm charts?

1

1 Answers

2
votes

helm create does what you are looking for. It creates a directory with all the basic stuff so that you don't need to manually create each file/directory. However, it can't create the content of a Chart it has no clue about.

But, there is no magic behind the scenes, a chart consists in templates and values. The templates are the same YAML files you are used to work with, except that you can replace whatever you want to make "dynamic" with the placeholders used by Helm. That's it.

So, in other words, just keep exporting as you are (I strongly suggest stopping doing this and create proper files suited for your needs) and add placeholders ({{ .Values.foo }})

For example, this is the template for a service I have:

apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.name | default .Chart.Name }}
spec:
  ports:
  - port: {{ .Values.port }}
    protocol: TCP
    targetPort: {{ .Values.port }}
  selector:
    app: {{ .Values.name | default .Chart.Name }}