- Take me to Practice Test
-
Run the command
kubectl get podsand count the number of pods.Details
$ kubectl get pods -
Run the command
kubectl run nginx --image=nginx.Details
$ kubectl run nginx --image=nginx -
Run the command
kubectl get podsand count the number of pods.Details
$ kubectl get pods --no-headers | wc -l -
Run the command
kubectl describe pod newpodslook under the containers section.Details
$ kubectl describe pod newpods | grep -w Image -
Run the command
kubectl describe pod newpodslook into theNodesection at the very beginning or simply run the commandkubectl get pods -o wide.Details
$ kubectl describe pod newpods -
Run the command
kubectl describe pod webappand look under the Containers section (or) Runkubectl get podsand look under the READY section.Details
$ kubectl describe pod webapp -
Run the command
kubectl describe pod webappand look under the containers section.Details
$ kubectl describe pod webapp -
Run the command
kubectl describe pod webappand look under the containers section.Details
$ kubectl describe pod webapp -
Run the command
kubectl describe pod webappand look under the events section.Details
$ kubectl describe pod webapp -
Run the command
kubectl get pods.Details
$ kubectl get pods -
Run the command
kubectl delete pod webapp.Details
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.Details
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 applycommand or usekubectl edit pod rediscommand.Details
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