100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CKAD QUESTIONS ANSWERED 2024 $13.99   Add to cart

Exam (elaborations)

CKAD QUESTIONS ANSWERED 2024

 8 views  0 purchase
  • Course
  • CKAD
  • Institution
  • CKAD

Exam of 19 pages for the course CKAD at CKAD (CKAD QUESTIONS)

Preview 3 out of 19  pages

  • August 7, 2024
  • 19
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • CKAD
  • CKAD
avatar-seller
Dreamer252
CKAD QUESTIONS


List all the namespaces in the cluster - answerkubectl get namespaces
kubectl get ns

List all the pods in all namespaces - answerkubectl get po --all-namespaces

List all the pods in the particular namespace - answerkubectl get po -n <namespace
name>

List all the services in the particular namespace - answerkubectl get svc -n <namespace
name>

List all the pods showing name and namespace with a json path expression -
answerkubectl get pods -o=jsonpath="{.items[*]['metadata.name',
'metadata.namespace']}"

Create an nginx pod in a default namespace and verify the pod running - answer//
creating a pod
kubectl run nginx --image=nginx --restart=Never

// List the pod
kubectl get po

Create the same nginx pod with a yaml file - answer// get the yaml file with --dry-run flag
kubectl run nginx --image=nginx --restart=Never --dry-run -o yaml > nginx-pod.yaml

// cat nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
resources: {}
dnsPolicy: ClusterFirst

, restartPolicy: Never
status: {}

// create a pod
kubectl create -f nginx-pod.yaml

Output the yaml file of the pod you just created - answerkubectl get po nginx -o yaml

Output the yaml file of the pod you just created without the cluster-specific information -
answerkubectl get po nginx -o yaml --export

Get the complete details of the pod you just created - answerkubectl describe pod nginx

Delete the pod you just created - answerkubectl delete po nginx
kubectl delete -f nginx-pod.yaml

Delete the pod you just created without any delay (force delete) - answerkubectl delete
po nginx --grace-period=0 --force

Create the nginx pod with version 1.17.4 and expose it on port 80 - answerkubectl run
nginx --image=nginx:1.17.4 --restart=Never --port=80

Change the Image version to 1.15-alpine for the pod you just created and verify the
image version is updated - answerkubectl set image pod/nginx nginx=nginx:1.15-alpine
kubectl describe po nginx

// another way it will open vi editor and change the version
kubeclt edit po nginx
kubectl describe po nginx

Change the Image version back to 1.17.1 for the pod you just updated and observe the
changes - answerkubectl set image pod/nginx nginx=nginx:1.17.1
kubectl describe po nginx
kubectl get po nginx -w # watch it

Check the Image version without the describe command - answerkubectl get po nginx -
o jsonpath='{.spec.containers[].image}{"\n"}'

Create the nginx pod and execute the simple shell on the pod - answer// creating a pod
kubectl run nginx --image=nginx --restart=Never

// exec into the pod
kubectl exec -it nginx /bin/sh

Get the IP Address of the pod you just created - answerkubectl get po nginx -o wide

, Create a busybox pod and run command ls while creating it and check the logs -
answerkubectl run busybox --image=busybox --restart=Never -- ls
kubectl logs busybox

If pod crashed check the previous logs of the pod - answerkubectl logs busybox -p

Create a busybox pod with command sleep 3600 - answerkubectl run busybox --
image=busybox --restart=Never -- /bin/sh -c "sleep 3600"

Check the connection of the nginx pod from the busybox pod - answerkubectl get po
nginx -o wide

// check the connection
kubectl exec -it busybox -- wget -o- <IP Address>

Create a busybox pod and echo message 'How are you' and delete it manually -
answerkubectl run busybox --image=nginx --restart=Never -it -- echo "How are you"

kubectl delete po busybox

Create a busybox pod and echo message 'How are you' and have it deleted
immediately - answer// notice the --rm flagkubectl run busybox --image=nginx --
restart=Never -it --rm -- echo "How are you"

Create an nginx pod and list the pod with different levels of verbosity - answer// 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=9

List the nginx pod with custom columns POD_NAME and POD_STATUS -
answerkubectl get po -o=custom-columns="POD_NAME:.metadata.name,
POD_STATUS:.status.containerStatuses[].state"

List all the pods sorted by name - answerkubectl get pods --sort-by=.metadata.name

List all the pods sorted by created timestamp - answerkubectl get pods--sort-
by=.metadata.creationTimestamp

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 - answer// first create single container pod with dry run flag

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Dreamer252. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $13.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79202 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$13.99
  • (0)
  Add to cart