github.com/migueleliasweb/helm@v2.6.1+incompatible/docs/chart_best_practices/pods.md (about) 1 # Pods and PodTemplates 2 3 This part of the Best Practices Guide discusses formatting the Pod and PodTemplate 4 portions in chart manifests. 5 6 The following (non-exhaustive) list of resources use PodTemplates: 7 8 - Deployment 9 - ReplicationController 10 - ReplicaSet 11 - DaemonSet 12 - StatefulSet 13 14 ## Images 15 16 A container image should use a fixed tag or the SHA of the image. It should not use the tags `latest`, `head`, `canary`, or other tags that are designed to be "floating". 17 18 19 Images _may_ be defined in the `values.yaml` file to make it easy to swap out images. 20 21 ``` 22 image: {{ .Values.redisImage | quote }} 23 ``` 24 25 An image and a tag _may_ be defined in `values.yaml` as two separate fields: 26 27 ``` 28 image: "{{ .Values.redisImage }}:{{ .Values.redisTag }}" 29 ``` 30 31 ## ImagePullPolicy 32 33 The `imagePullPolicy` should default to an empty value, but allow users to override it: 34 35 ```yaml 36 imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} 37 ``` 38 39 ## PodTemplates Should Declare Selectors 40 41 All PodTemplate sections should specify a selector. For example: 42 43 ```yaml 44 selector: 45 matchLabels: 46 app: MyName 47 template: 48 metadata: 49 labels: 50 app: MyName 51 ``` 52 53 This is a good practice because it makes the relationship between the set and 54 the pod. 55 56 But this is even more important for sets like Deployment. 57 Without this, the _entire_ set of labels is used to select matching pods, and 58 this will break if you use labels that change, like version or release date. 59 60