Question
Create secure environment variables and configure the pod as per below specifications:
pod name: secure-pod
Image: nginx
Environment variables:
Key Value
username admin
password cka@2022!
Answerkubectl create secret generic my-secret --from-literal=username=admin --from-literal=password=cka@2022!
Create pod manifest:
apiVersion: v1
kind: Pod
metadata:
name: secure-pod
spec:
containers:
- name: secure-pod
image: nginx
envFrom:
- secretRef:
name: my-secret
Apply:
kubectl apply -f po.yaml
Verify:
kubectl exec -it secure-pod -- env|grep -i "username\|password"