Free CKA Exam Braindumps
Certified Kubernetes Administrator Questions 46–50 (page: 11)

Updated On: 10-Feb-2026

Create a deployment called webapp with image nginx having 5 replicas in it, put the file in /tmp directory with named webapp.yaml

  1. Solution:

    //Create a file using dry run command
    kubectl create deploy --image=nginx --dry-run -o yaml > /tmp/webapp.yaml
    // Now, edit file webapp.yaml and update replicas=5
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    labels:
    app: webapp
    name: webapp
    spec:
    replicas: 5
    selector:
    matchLabels:
    app: webapp
    template:
    metadata:
    labels:
    app: webapp
    spec:
    containers:
    - image: nginx
    name: nginx
    Note: Search "deployment" in kubernetes.io site , you will get the page
    https://kubernetes.io/docs/concepts/workloads/controllers/deplo


    yment/
    // Verify the Deployment
    kubectl get deploy webapp --show-labels
    // Output the YAML file of the deployment webapp
    kubectl get deploy webapp -o yaml

Answer(s): A



Get the list of pods of webapp deployment

  1. Solution:

    // Get the label of the deployment
    kubectl get deploy --show-labels
    // Get the pods with that label
    kubectl get pods -l app=webapp

Answer(s): A



Scale the deployment from 5 replicas to 20 replicas and verify

  1. Solution:

    kubectl scale deploy webapp --replicas=20
    kubectl get deploy webapp
    kubectl get po -l app=webapp

Answer(s): A



Get the deployment rollout status

  1. Solution:

    kubectl rollout status deploy webapp

Answer(s): A



Deployment

Create a deployment of webapp with image nginx:1.17.1 with container port 80 and verify the image version

  1. Solution:
    // Create initial YAML file with ­dry-run option
    kubectl create deploy webapp --image=nginx:1.17.1 --dryrun=client -o yaml > webapp.yaml vim webapp.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
    labels:
    app: webapp
    name: webapp
    spec:
    replicas: 1
    selector:
    matchLabels:
    app: webapp
    template:
    metadata:
    labels:
    app: webapp
    spec:
    containers:
    - image: nginx:1.17.1
    name: nginx
    kubectl create -f webapp.yaml ­record=true
    //Verify Image Version
    kubectl describe deploy webapp | grep -i "Image"
    Using JsonPath
    kubectl get deploy -o=jsonpath='{range.items [*]}{.[*]} {.metadata.name}{"\t"}{.spec.template.spec.containers[*].i mage}{"\n"}'

Answer(s): A



Viewing page 11 of 26
Viewing questions 51 - 55 out of 122 questions


Post your Comments and Discuss Linux Foundation CKA exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!