Created
January 23, 2023 20:02
-
-
Save jeff-french/a54c1a53f845dd4f3c8b8a833ae5bbfb to your computer and use it in GitHub Desktop.
Pod Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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