Create 2 nginx image pods in which one of them is labelled with env=prod and another one labelled with env=dev and verify the same.

Create 2 nginx image pods in which one of them is labelled with env=prod and another one labelled with env=dev and verify the same.
A . Solution:
kubectl run –generator=run-pod/v1 –image=nginx — labels=env=prod nginx-prod –dry-run -o yaml >
nginx-prodpod.yaml Now, edit nginx-prod-pod.yaml file and remove entries like "creationTimestamp:
null" "dnsPolicy: ClusterFirst"
vim nginx-prod-pod.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
env: prod
name: nginx-prod
spec:

containers:
– image: nginx name: nginx-prod restartPolicy: Always
#
kubectl create -f nginx-prod-pod.yaml
kubectl run –generator=run-pod/v1 –image=nginx —
labels=env=dev nginx-dev –dry-run -o yaml > nginx-dev-pod.yaml apiVersion: v1
kind: Pod metadata: labels: env: dev name: nginx-dev spec:
containers:
– image: nginx name: nginx-dev restartPolicy: Always
#
kubectl create -f nginx-prod-dev.yaml Verify :
kubectl get po –show-labels
kubectl get po -l env=prod
kubectl get po -l env=dev

Answer: A

Latest CKA Dumps Valid Version with 122 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments