forked from Sonal0409/DevOps_ClassNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigMapsNotes
More file actions
45 lines (35 loc) · 871 Bytes
/
configMapsNotes
File metadata and controls
45 lines (35 loc) · 871 Bytes
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
# kubectl get configmap
# kubectl create configmap dev-config --from-literal=app.mem=2048m
# kubectl get configmap
# kubectl get configmap dev-config -o yaml
# vim dev.properties
app.env:dev
app.mem=2048m
app.properties=dev.env.url
:wq!
# kubectl create configmap dev-config1 --from-file=dev.properties
# kubectl get configmap
# kubectl get configmap dev-config1 -o yaml
Use configmap for a pod
vim pod-configmap.yml
kind: Pod
apiVersion: v1
metadata:
name: pod-configmap
spec:
containers:
- image: nginx
name: c1
volumeMounts:
- name: config-volume
mountPath: /etc/config
volumes:
- name: config-volume
configMap:
name: dev-config1
restartPolicy: Never
:wq!
# kubectl apply -f pod-configmap.yml
# kubectl exec -it pod-configmap bash
# cd /etc/config
you will find the dev.properties file and configurations