Skip to content

Instantly share code, notes, and snippets.

@jeff-french
Created January 23, 2023 20:02
Show Gist options
  • Save jeff-french/a54c1a53f845dd4f3c8b8a833ae5bbfb to your computer and use it in GitHub Desktop.
Save jeff-french/a54c1a53f845dd4f3c8b8a833ae5bbfb to your computer and use it in GitHub Desktop.
Pod Example
apiVersion: v1
kind: Pod
metadata:
name: configmap-demo-pod
spec:
containers:
- name: demo
image: alpine
command: ["sleep", "3600"]
env:
# Define the environment variable
- name: PLAYER_INITIAL_LIVES # Notice that the case is different here
# from the key name in the ConfigMap.
valueFrom:
configMapKeyRef:
name: game-demo # The ConfigMap this value comes from.
key: player_initial_lives # The key to fetch.
- name: UI_PROPERTIES_FILE_NAME
valueFrom:
configMapKeyRef:
name: game-demo
key: ui_properties_file_name
volumeMounts:
- name: config
mountPath: "/config"
readOnly: true
volumes:
# You set volumes at the Pod level, then mount them into containers inside that Pod
- name: config
configMap:
# Provide the name of the ConfigMap you want to mount.
name: game-demo
# An array of keys from the ConfigMap to create as files
items:
- key: "game.properties"
path: "game.properties"
- key: "user-interface.properties"
path: "user-interface.properties"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment