-
Notifications
You must be signed in to change notification settings - Fork 2
/
Overview of ConfigMap.yml
63 lines (54 loc) · 1.43 KB
/
Overview of ConfigMap.yml
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
55
56
57
58
59
60
61
kind: ConfigMap
apiVersion: v1
metadata:
creationTimestamp: 2017-12-04T13:55:41+00:00
name: example-config
namespace: default
# Data Section that contains multiple key-value pairs
data:
example.property.1: hello
example.property.2: world
example.property.file: |-
property.1=value-1
property.2=value-2
property.3=value-3
# We can also create a configMap from an existing file that already contains configuration
# Example configMap:
apiVersion: v1
kind: ConfigMap
metadata:
name: special-config
namespace: default
data:
special.how: very
special.type: charm
# Example pod using the "special-config" ConfigMap
apiVersion: v1
kind: Pod
metadata:
name: dapi-test-pod
spec:
containers:
- name: test-container
image: gcr.io/xyz
command: ["/bin/sh", "-c", "env"]
env:
- name: SPECIAL_LEVEL_KEY
valueFrom:
configMapKeyRef:
name: special-config
key: special.how
- name: SPECIAL_TYPE_KEY
valueFrom:
configMapKeyRef:
name: special-config
key: special.type
restartPolicy: Never
# Configuration data can be consumed in pods in a variety of ways
#
# ConfigMap can be used to:
# 1. Populate the value of environment variable
# 2. Set command-line arguments in a container
# 3. Populate the configuration files in a volume
#
# Users and system components may store configuration data in a ConfigMap