Change the Image version back to 1.17.1 for the pod you just updated and observe the changes
Change the Image version back to 1.17.1 for the pod you just updated and observe the changesA . Solution: kubectl set image pod/nginx nginx=nginx:1.17.1 kubectl describe po nginx kubectl get po nginx -w # watch itView AnswerAnswer: A
List the nginx pod with custom columns POD_NAME and POD_STATUS
List the nginx pod with custom columns POD_NAME and POD_STATUSA . Solution: kubectl get po -o=custom-columns="POD_NAME:.metadata.name, POD_STATUS:.status.containerStatuses[].state"View AnswerAnswer: A
Create the nginx pod with version 1.17.4 and expose it on port 80
Create the nginx pod with version 1.17.4 and expose it on port 80A . Solution: kubectl run nginx --image=nginx:1.17.4 --restart=Never -- port=80View AnswerAnswer: A
Get list of all pods in all namespaces and write it to file "/opt/pods-list.yaml"
Get list of all pods in all namespaces and write it to file "/opt/pods-list.yaml"A . Solution: kubectl get po -all-namespaces > /opt/pods-list.yamlView AnswerAnswer: A
Create a nginx pod with label env=test in engineering namespace See the solution below.
Create a nginx pod with label env=test in engineering namespace See the solution below.A . Solution: kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry- run -o yaml > nginx-pod.yaml kubectl run nginx --image=nginx --restart=Never --labels=env=test --namespace=engineering --dry- run -o yaml | kubectl create -n engineering -f - YAML File: apiVersion:...
Get list of all the pods showing name and namespace with a jsonpath expression.
Get list of all the pods showing name and namespace with a jsonpath expression.A . Solution: kubectl get pods -o=jsonpath="{.items[*]['metadata.name' , 'metadata.namespace']}"View AnswerAnswer: A
Create an nginx pod and list the pod with different levels of verbosity
Create an nginx pod and list the pod with different levels of verbosityA . Solution: // create a pod kubectl run nginx --image=nginx --restart=Never --port=80 // List the pod with different verbosity kubectl get po nginx --v=7 kubectl get po nginx --v=8 kubectl get po nginx --v=9View AnswerAnswer: A
Create an nginx pod and set an env value as 'var1=val1'. Check the env value existence within the pod
Create an nginx pod and set an env value as 'var1=val1'. Check the env value existence within the podA . Solution: kubectl run nginx --image=nginx --restart=Never --env=var1=val1 # then kubectl exec -it nginx -- env # or kubectl exec -it nginx -- sh -c 'echo $var1' # or kubectl describe...
Check the Image version of nginx-dev pod using jsonpath
Check the Image version of nginx-dev pod using jsonpathA . Solution: kubect1 get po nginx-dev -o jsonpath='{.spec.containers[].image}{""}'View AnswerAnswer: A
Check the image version in pod without the describe command
Check the image version in pod without the describe commandA . Solution: kubectl get po nginx -o jsonpath='{.spec.containers[].image}{""}'View AnswerAnswer: A