- Take me to Practice Test
-
Run the command
kubectl get pods
and count the number of pods.$ kubectl get pods
-
Run the command
kubectl run nginx --image=nginx
.$ kubectl run nginx --image=nginx
-
Run the command
kubectl get pods
and count the number of pods.$ kubectl get pods --no-headers | wc -l
-
Run the command
kubectl describe pod newpods
look under the containers section.$ kubectl describe pod newpods | grep -w Image
-
Run the command
kubectl describe pod newpods
look into theNode
section at the very beginning or simply run the commandkubectl get pods -o wide
.$ kubectl describe pod newpods
-
Run the command
kubectl describe pod webapp
and look under the Containers section (or) Runkubectl get pods
and look under the READY section.$ kubectl describe pod webapp
-
Run the command
kubectl describe pod webapp
and look under the containers section.$ kubectl describe pod webapp
-
Run the command
kubectl describe pod webapp
and look under the containers section.$ kubectl describe pod webapp
-
Run the command
kubectl describe pod webapp
and look under the events section.$ kubectl describe pod webapp
-
Run the command
kubectl get pods
.$ kubectl get pods
-
Run the command
kubectl delete pod webapp
.To delete the pod without any delay and confirmation, we can add --force flag.$ kubectl delete pod webapp --force
-
Create a pod definition YAML file and use it to create a POD or use the command
kubectl run redis --image=redis123
.To create a pod definition yaml file:$ kubectl run redis --image=redis123 --dry-run=client -oyaml > redis.yaml $ kubectl create -f redis.yaml
-
Now fix the image on the pod to
redis
. Update the pod-definition file and usekubectl apply
command or usekubectl edit pod redis
command.Fix the image name in the redis.yaml file and apply the changes. $ kubectl apply -f redis.yaml Direct edit in the running pod. $ kubectl edit pod redis