Secrets-Kubernetes Certification- Crack the CKA with WeMakeDevOps



1)Create a kubernetes secret from given value ?

user = admin
password = 1234

Solution:

kubectl create secret generic mysecret –from-literal username=admin –from-literal password=1234

2) Use above secret value as a env variable in pod

apiVersion: v1
kind: Pod
metadata:
name: secret-env-pod
spec:
containers:
– name: mycontainer
image: redis
env:
– name: SECRET_USERNAME
valueFrom:
secretKeyRef:
name: mysecret
key: username
– name: SECRET_PASSWORD
valueFrom:
secretKeyRef:
name: mysecret
key: password

source

Avatar of WeMake

By WeMake

2 thoughts on “Secrets-Kubernetes Certification- Crack the CKA with WeMakeDevOps”

Leave a Reply

Your email address will not be published.

Captcha loading...