-
Notifications
You must be signed in to change notification settings - Fork 0
/
10-k8s-configmap-env-vol.yaml
54 lines (52 loc) · 1.23 KB
/
10-k8s-configmap-env-vol.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
apiVersion: v1
kind: ConfigMap
metadata:
name: mycfgmap
data:
# property-like keys; each key maps to a simple value
env: dev
# file-like keys
dest.properties: |
Q_INPUT=InputQ
Q_OUTPUT=OutputQ
debug.properties: |
TracerMode=always
LogLevel=INFO
---
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: mycontainer
image: nginx
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 80
env:
# Define the environment variable
- name: ENV
valueFrom:
configMapKeyRef:
name: mycfgmap # The ConfigMap this value comes from.
key: env # The key to fetch.
volumeMounts:
- mountPath: /config
name: config-vol
readOnly: true
volumes:
# You set volumes at the Pod level, then mount them into containers inside that Pod
- name: config-vol
configMap:
# Provide the name of the ConfigMap you want to mount.
name: mycfgmap
# An array of keys from the ConfigMap to create as files
items:
- key: "dest.properties"
path: "dest.properties"
- key: "debug.properties"
path: "debug.properties"