forked from kubernetes/website
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#37491 from Rishit-dagli/Rishit-dagli-co…
…nfigmaps-pods Update example to configure pods from configmap
- Loading branch information
Showing
2 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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" | ||
|