dynamic secret in pod mounted as volume definition files
#779
- Author
- Anonymous
- Created
- June 3, 2023, 6:23 p.m.
- Expires
- June 1, 2025, 8 a.m.
- Size
- 1.1Â KB
- Hits
- 69
- Syntax
- YAML
- Private
- â No
# iwant to test out a pod getting a new configmap or secret value in a volume
# 1. k create this file
# 2. k exec my pod --stdin --tty -- cat /etc/config/db-url
# 3. notice it prints out localhost:54321
# 4. edit configmap file with a new db-url value and k apply the change
# 5. k exec my pod --stdin --tty -- cat /etc/config/db-url
# 6. notice that after a few second, the new value is printed
apiVersion: v1
data:
db-url: localhost:54321
kind: ConfigMap
metadata:
creationTimestamp: null
name: my-configmap
---
apiVersion: v1
data:
passwd: MTIzNDU=
kind: Secret
metadata:
creationTimestamp: null
name: my-secret
---
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: my-image
volumeMounts:
- name: config-volume
mountPath: /etc/config
- name: secret-volume
mountPath: /etc/secret
volumes:
- name: config-volume
configMap:
name: my-configmap
- name: secret-volume
secret:
secretName: my-secret