File tree Expand file tree Collapse file tree 2 files changed +40
-40
lines changed
docs/concepts/configuration Expand file tree Collapse file tree 2 files changed +40
-40
lines changed Original file line number Diff line number Diff line change @@ -111,46 +111,7 @@ technique also lets you access a ConfigMap in a different namespace.
111
111
112
112
Here's an example Pod that uses values from ` game-demo` to configure a Pod:
113
113
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" >}}
154
115
155
116
A ConfigMap doesn't differentiate between single line property values and
156
117
multi-line file-like values.
Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments