Helm charts are used to create all the elements needed to use you application.
your service, deployment, ingress and accounts etc. There are various other things to do.
You can manually create a helm chart file structure or you can use
helm create <template_name>
This will create the folder structure you need which look something like:
|-values.yaml
|-Chart.yaml
|-.helmignore
|-template
|
|- ingress.yaml
|- service.yaml
|- deployment.yalm
|- tests
|
|-test-connection.yaml
The values.yaml file will hold values that are distrubuted throughout the underlying templates folder.
For example. In deployment.yaml you will always need replicaCount:value.
Instead you can declare this in the values.yaml and then you can use:
service.yaml
replicas: {{ Values.replicaCount }}
Below you can see a example values.yaml file. These values can be see being used in deployment.yaml
values.yaml
replicaCount: 1
metadata:
label: forex-website
image:
repository: registry.kroup.xyz
name: forex-website
tag: 0.3
pullPolicy: IfNotPresent
service:
type: ClusterIP
port: 80
ingress:
host: website.kroup.xyz
Notice how the values are used. If a combination of template values are required quotation marks can be used to combine thes values. See line 18.
deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: forex-website
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: forex-website
template:
metadata:
labels:
app: forex-website
spec:
containers:
- name: forex-website
image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
ports:
- containerPort: 80