Check logs of each container that "busyboxpod-{1,2,3}"

Check logs of each container that "busyboxpod-{1,2,3}"A . Solution: kubectl logs busybox -c busybox-container-1 kubectl logs busybox -c busybox-container-2 kubectl logs busybox -c busybox-container-3View AnswerAnswer: A

December 10, 2020 No Comments READ MORE +

Create a Pod with three busy box containers with commands "ls; sleep 3600;", "echo Hello World; sleep 3600;" and "echo this is the third container; sleep 3600" respectively and check the status

Create a Pod with three busy box containers with commands "ls; sleep 3600;", "echo Hello World; sleep 3600;" and "echo this is the third container; sleep 3600" respectively and check the statusA . Solution: // first create single container pod with dry run flag kubectl run busybox --image=busybox --restart=Always --dry-run...

December 9, 2020 No Comments READ MORE +

Create a redis pod and expose it on port 6379

Create a redis pod and expose it on port 6379A . Solution: kubectl run redis --image=redis --restart=Never --port=6379 YAML File : apiVersion: v1 kind: Pod metadata: labels: run: redis name: redis spec: containers: - image: redis name: redis ports: - containerPort: 6379 Rt restartPolicy: AlwaysView AnswerAnswer: A

December 9, 2020 No Comments READ MORE +

List "nginx-dev" and "nginx-prod" pod and delete those pods

List "nginx-dev" and "nginx-prod" pod and delete those podsA . Solution: kubect1 get pods -o wide kubectl delete po "nginx-dev" kubectl delete po "nginx-prod"View AnswerAnswer: A

December 9, 2020 No Comments READ MORE +

Create a pod with environment variables as var1=value1.Check the environment variable in pod

Create a pod with environment variables as var1=value1.Check the environment variable in podA . Solution: kubectl run nginx --image=nginx --restart=Never --env=var1=value1 # then kubectl exec -it nginx -- env # or kubectl exec -it nginx -- sh -c 'echo $var1' # or kubectl describe po nginx | grep value1View AnswerAnswer:...

December 8, 2020 No Comments READ MORE +

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"...

December 8, 2020 No Comments READ MORE +

List all the pods sorted by name

List all the pods sorted by nameA . Solution: kubect1 get pods --sort-by=.metadata.nameView AnswerAnswer: A

December 8, 2020 No Comments READ MORE +

Delete the pod without any delay (force delete)

Delete the pod without any delay (force delete)A . Solution: Kubect1 delete po "POD-NAME" --grace-period=0 -forceView AnswerAnswer: A

December 7, 2020 No Comments READ MORE +

List all the pods sorted by created timestamp

List all the pods sorted by created timestampA . Solution: kubect1 get pods--sort-by=.metadata.creationTimestampView AnswerAnswer: A

December 7, 2020 No Comments READ MORE +

Create a redis pod, and have it use a non-persistent storage Note: In exam, you will have access to kubernetes.io site, Refer : https://kubernetes.io/docs/tasks/configure-pod-container/configurevolume-storage/

Create a redis pod, and have it use a non-persistent storage Note: In exam, you will have access to kubernetes.io site, Refer : https://kubernetes.io/docs/tasks/configure-pod-container/configurevolume-storage/A . Solution: apiVersion: v1 kind: Pod metadata: name: redis spec: containers: - name: redis image: redis volumeMounts: - name: redis-storage mountPath: /data/redis ports: - containerPort: 6379...

December 5, 2020 No Comments READ MORE +