Helm template basics
Helm templates are used to dynamically generate Kubernetes YAML Ain’t Markup Language (YAML) (or JavaScript Object Notation (JSON)) resources. They consume a set of default and user-provided values to generate resources that comprise a Kubernetes application. You’ve had some exposure to templates already in Chapter 4, Scaffolding a New Helm Chart, when you ran the helm create
command, which generated a set of starter templates. In the Git repository cloned previously, these templates are located at chapter6/guestbook/templates/
. Here’s a short snippet of the deployment.yaml
Helm template, located within the chapter6/guestbook/templates/deployment.yaml
file:
apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "guestbook.fullname" . }} labels: {{- include "guestbook.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} ...