Launch Your First Kubernetes Pod

KubernetesBeginner
Practice Now

Introduction

In this challenge, you will be tasked with demonstrating your ability to deploy a basic web service in a local Kubernetes environment. You will be required to create and manage a simple pod using Minikube, a tool for running Kubernetes locally. The goal is to test your skills in creating a pod, verifying its deployment, and ensuring the pod is running the correct image and in the desired state.

This is a Challenge, which differs from a Guided Lab in that you need to try to complete the challenge task independently, rather than following the steps of a lab to learn. Challenges are usually a bit difficult. If you find it difficult, you can discuss with Labby or check the solution. Historical data shows that this is a beginner level challenge with a 98% pass rate. It has received a 100% positive review rate from learners.

Deploy Nginx Pod

As a new cloud engineer, you've been tasked with demonstrating your ability to deploy a basic web service in a local Kubernetes environment. This challenge will test your skills in creating and managing a simple pod using Minikube.

Tasks

  • Create a pod named web-server using the nginx:latest image
  • Verify that the pod is running in the default namespace
  • Ensure the pod is successfully deployed and ready to serve web content

Requirements

  • Use kubectl to create the pod
  • Name the pod exactly web-server
  • Use the nginx:latest image for the pod
  • Deploy the pod in the default namespace
  • Ensure the pod is in a Running state
  • Work within the ~/project directory

Examples

Example of a successful pod deployment:

NAME        READY   STATUS    RESTARTS   AGE
web-server  1/1     Running   0          30s

Hints

  • Use minikube start to start a Kubernetes cluster
  • You can create the pod in two ways:
    1. Using imperative commands with kubectl run (research the parameters needed)
    2. Using a YAML file:
      • Research the basic structure for a Pod YAML definition
      • Remember to include apiVersion, kind, metadata and spec sections
      • Your pod should be named exactly as specified in the requirements
      • Consider what container settings you need to include
  • Check the pod status using kubectl get pods
  • If you encounter issues, use kubectl describe pod web-server for more information
  • Ensure Minikube is running before creating the pod
✨ Check Solution and Practice

Summary

In summary, this challenge requires you to create a pod named web-server using the nginx:latest image, and then verify that the pod is running in the default namespace and is in a Running state. You will need to use kubectl commands to create and manage the pod, and ensure that it meets the specified requirements.