Link Search Menu Expand Document

PodPreset

pod-preset.yaml

---
apiVersion: settings.k8s.io/v1alpha1
kind: PodPreset
metadata:
  name: pod-preset-simple
spec:
  selector:
    matchLabels:
      role: frontend
  env:
    - name: DB_PORT
      value: "6379"
  volumeMounts:
    - mountPath: /cache
      name: pod-preset-simple-cache-volume
  volumes:
    - name: pod-preset-simple-cache-volume
      emptyDir: {}

PodPreset Example


  1. Change the metadata name tag to the name you want
  2. Set the role. The preset will act on all Pods with the same role.
  3. Set the environment variables and values you need for the Pods.
  4. Mount a volume if wanted.

Reference: https://kubernetes.io/docs/tasks/inject-data-application/podpreset/