Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

CKA Practice Exam: Part 1

Services are an important part of accessing pods in Kubernetes. They ensure that the ephemeral nature of pods does not interrupt the end user experience. In this hands-on lab, you’ll be tasked with creating a deployment and a service, making sure you can access the application running on those pods without the potential of service interruptions. This will simulate a question you may receive on the Certified Kubernetes Administrator (CKA) exam.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 30m
Published
Clock icon Mar 31, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create a Deployment Named webapp in the web Namespace and Verify Connectivity

    1. Use the following command to create a namespace named web:

      kubectl create ns web
      
    2. Use the following command to create a deployment named webapp:

      kubectl run webapp --image=linuxacademycontent/podofminerva:latest --port=80 --replicas=3 -n web
      
  2. Challenge

    Create a Service Named web-service and Forward Traffic from the Pods

    1. Use the following command to get the IP address of a pod that’s a part of the deployment:

      kubectl get po -o wide -n web
      
    2. Use the following command to create a temporary pod with a shell to its container:

      kubectl run busybox --image=busybox --rm -it --restart=Never -- sh
      
    3. Use the following command (from the container’s shell) to send a request to the web pod:

      wget -O- <pod_ip_address>:80
      
    4. Use the following command to create the YAML for the service named web-service:

      kubectl expose deployment/webapp --port=80 --target-port=80 --type=NodePort -n web --dry-run -o yaml > web-service.yaml
      
    5. Use Vim to add the namespace and the NodePort to the YAML:

      vim web-service.yaml
      

      Change the name to web-service, add the namespace web, and add nodePort: 30080.

    6. Use the following command to create the service:

      kubectl apply -f web-service.yaml
      
    7. Use the following command to verify that the service is responding on the correct port:

      curl localhost:30080
      
    8. Use the following command to modify the deployment:

      kubectl edit deploy webapp -n web
      
    9. Add the liveness probe and the readiness probe:

      livenessProbe:
        httpGet:
          path: /healthz
          port: 8081
      readinessProbe:
        httpGet:
          path: /
          port: 80
      
    10. Use the following command to check if the pods are running:

      kubectl get po -n web
      
    11. Use the following command to check if the probes were added to the pods:

      kubectl get po <pod_name> -o yaml -n web --export
      

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans