Free CKA Exam Braindumps (page: 13)

Page 13 of 31

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



Update the deployment with the image version 1.17.4 and verify

  1. Solution:

    kubectl set image deploy/webapp nginx=nginx:1.17.4
    //Verify
    kubectl describe deploy webapp | grep Image
    kubectl get deploy -o=jsonpath='{range.items [*]}{.[*]} {.metadata.name}{"\t"}{.spec.template.spec.containers[*].i mage}{"\n"}'

Answer(s): A



Check the rollout history and make sure everything is ok after the update

  1. Solution:

    kubectl rollout history deploy webapp
    kubectl get deploy webapp --show-labels
    kubectl get rs -l app=webapp
    kubectl get po -l app=webapp

Answer(s): A



Page 13 of 31



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

Atsushi commented on January 13, 2024
That's good!!
Anonymous
upvote