Configmap
apiVersion: v1
kind: ConfigMap
metadata:
name: configmap
data:
config-data: |
username: "admin"
password: "admin123"
Configmap Pod
apiVersion: v1
kind: Pod
metadata:
name: confipod
spec:
containers:
- name: demo-container
image: nginx
volumeMounts:
- name: config
mountPath: /etc/config
volumes:
- name: config
configMap:
name: configmap
Secret
apiVersion: v1
kind: Secret
metadata:
name: secretfile
type: Opaque
data:
user_name: YWRtaW4K
password: YWRtaW4xMjMK
Secret Pod
apiVersion: v1
kind: Pod
metadata:
name: secret-demo
spec:
containers:
- name: secret-container
image: nginx
volumeMounts:
- name: secret
readOnly: true
mountPath: /etc/secret
volumes:
- name: secret
secret:
secretName: secretfile