Creating Helm Chart
The simple way to get started with a new chart is to use the helm create command. Use this below command to create a new chart named as mychart in a new directory:
helm create mychart
Helm will create a new directory in your system called mychart with the structure shown as below.
If we look carefully a directory is created inside our chart with the name templates.
What are Templates?
The most important part of the chart is the templates/ directory. This is the place where Helm finds the YAML definitions for Services, Deployments and other Kubernetes objects. If you have already got definitions for your application, all you would like to try to do is replace the generated YAML files for your own.
Let’s have a look on service.yaml in template directory
What are Values?
The template in service.yaml will make the use of Helm-specific objects chart and its values. The latter values object could be a key part of Helm charts, accustomed expose configuration that may be set at the time of readying. The defaults for this object area unit outlined within the values.yaml file. Strive dynamic the default price for service. internal Port and execute another dry-run, you must notice that the target Port within the Service and therefore the container Port within the readying changes.
Let’s have a look on our values.yaml
If we look carefully the image name has been set to nginx and the port no. 80 which means that when we will deploy this chart it will create deployment for nginx along with the service with the type of ClusterIP. If we want to deploy our own image then we can enter the name of that image here and we can also modify the port no. and service type according to our requirements. But for the demo purpose we will run it as nginx only.