Skip to content

Commit f7c637f

Browse files
committed
Kubernetes: Fix formatting in ConfigMap and enhance pod configuration for clarity
Signed-off-by: NotHarshhaa <[email protected]>
1 parent a0ec4a4 commit f7c637f

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

Diff for: configmap/configmap.yaml

+31-19
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,44 @@ data:
77
database: "mydatabase"
88
site.settings: |
99
color=blue
10-
padding:25px
10+
padding: 25px
1111
---
1212
apiVersion: v1
1313
kind: Pod
1414
metadata:
1515
name: configmappod
1616
spec:
1717
containers:
18-
- name: configmapcontainer
19-
image: nginx
20-
env:
21-
- name: DB_SERVER
22-
valueFrom:
23-
configMapKeyRef:
24-
name: myconfigmap
25-
key: db_server
26-
- name: DATABASE
27-
valueFrom:
28-
configMapKeyRef:
29-
name: myconfigmap
30-
key: database
31-
volumeMounts:
32-
- name: config-vol
33-
mountPath: "/config"
34-
readOnly: true
18+
- name: configmapcontainer
19+
image: nginx
20+
env:
21+
- name: DB_SERVER
22+
valueFrom:
23+
configMapKeyRef:
24+
name: myconfigmap
25+
key: db_server
26+
- name: DATABASE
27+
valueFrom:
28+
configMapKeyRef:
29+
name: myconfigmap
30+
key: database
31+
volumeMounts:
32+
- name: config-vol
33+
mountPath: "/config"
34+
readOnly: true
3535
volumes:
3636
- name: config-vol
3737
configMap:
38-
name: myconfigmap
38+
name: myconfigmap
39+
items:
40+
- key: site.settings
41+
path: "site.settings" # Mount only the relevant file from the ConfigMap
42+
restartPolicy: Always
43+
dnsPolicy: ClusterFirst
44+
securityContext:
45+
runAsNonRoot: true
46+
allowPrivilegeEscalation: false
47+
terminationGracePeriodSeconds: 30
48+
hostNetwork: false
49+
hostIPC: false
50+
hostPID: false

0 commit comments

Comments
 (0)