Skip to content

Commit 6d0f8be

Browse files
committed
Update example to configure pods
1 parent bdadfbc commit 6d0f8be

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

content/en/docs/concepts/configuration/configmap.md

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -111,46 +111,7 @@ technique also lets you access a ConfigMap in a different namespace.
111111
112112
Here's an example Pod that uses values from `game-demo` to configure a Pod:
113113

114-
```yaml
115-
apiVersion: v1
116-
kind: Pod
117-
metadata:
118-
name: configmap-demo-pod
119-
spec:
120-
containers:
121-
- name: demo
122-
image: alpine
123-
command: ["sleep", "3600"]
124-
env:
125-
# Define the environment variable
126-
- name: PLAYER_INITIAL_LIVES # Notice that the case is different here
127-
# from the key name in the ConfigMap.
128-
valueFrom:
129-
configMapKeyRef:
130-
name: game-demo # The ConfigMap this value comes from.
131-
key: player_initial_lives # The key to fetch.
132-
- name: UI_PROPERTIES_FILE_NAME
133-
valueFrom:
134-
configMapKeyRef:
135-
name: game-demo
136-
key: ui_properties_file_name
137-
volumeMounts:
138-
- name: config
139-
mountPath: "/config"
140-
readOnly: true
141-
volumes:
142-
# You set volumes at the Pod level, then mount them into containers inside that Pod
143-
- name: config
144-
configMap:
145-
# Provide the name of the ConfigMap you want to mount.
146-
name: game-demo
147-
# An array of keys from the ConfigMap to create as files
148-
items:
149-
- key: "game.properties"
150-
path: "game.properties"
151-
- key: "user-interface.properties"
152-
path: "user-interface.properties"
153-
```
114+
{{< codenew file="configmap/configure-pod.yaml" >}}
154115

155116
A ConfigMap doesn't differentiate between single line property values and
156117
multi-line file-like values.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: configmap-demo-pod
5+
spec:
6+
containers:
7+
- name: demo
8+
image: alpine
9+
command: ["sleep", "3600"]
10+
env:
11+
# Define the environment variable
12+
- name: PLAYER_INITIAL_LIVES # Notice that the case is different here
13+
# from the key name in the ConfigMap.
14+
valueFrom:
15+
configMapKeyRef:
16+
name: game-demo # The ConfigMap this value comes from.
17+
key: player_initial_lives # The key to fetch.
18+
- name: UI_PROPERTIES_FILE_NAME
19+
valueFrom:
20+
configMapKeyRef:
21+
name: game-demo
22+
key: ui_properties_file_name
23+
volumeMounts:
24+
- name: config
25+
mountPath: "/config"
26+
readOnly: true
27+
volumes:
28+
# You set volumes at the Pod level, then mount them into containers inside that Pod
29+
- name: config
30+
configMap:
31+
# Provide the name of the ConfigMap you want to mount.
32+
name: game-demo
33+
# An array of keys from the ConfigMap to create as files
34+
items:
35+
- key: "game.properties"
36+
path: "game.properties"
37+
- key: "user-interface.properties"
38+
path: "user-interface.properties"
39+

0 commit comments

Comments
 (0)