0
0
Kubernetesdevops~30 mins

Creating Pods with kubectl in Kubernetes - Try It Yourself

Choose your learning style9 modes available
Creating Pods with kubectl
📖 Scenario: You are working as a DevOps engineer managing containerized applications. You need to create a simple Pod in Kubernetes to run a basic web server container.
🎯 Goal: Learn how to create a Kubernetes Pod using kubectl commands and YAML configuration files step-by-step.
📋 What You'll Learn
Create a YAML file defining a Pod named web-pod running the nginx container
Add a label app: web to the Pod
Use kubectl to create the Pod from the YAML file
Verify the Pod is running using kubectl get pods
💡 Why This Matters
🌍 Real World
Creating Pods is a fundamental task in deploying containerized applications on Kubernetes clusters.
💼 Career
DevOps engineers and site reliability engineers often create and manage Pods to run application workloads reliably.
Progress0 / 4 steps
1
Create the Pod YAML file
Create a file named web-pod.yaml with the following content exactly: a Pod named web-pod running the nginx container and labeled with app: web.
Kubernetes
Need a hint?

Use apiVersion: v1, kind: Pod, and define metadata with name and labels. Under spec, add one container named nginx with image nginx.

2
Create the Pod using kubectl
Run the kubectl create -f web-pod.yaml command to create the Pod from the YAML file you made.
Kubernetes
Need a hint?

Use the kubectl create -f command followed by your YAML file name to create the Pod.

3
Check the Pod status
Use the command kubectl get pods to list all Pods and check that web-pod is created and running.
Kubernetes
Need a hint?

Simply run kubectl get pods to see the list of Pods and their status.

4
Verify the Pod is running
Look at the output of kubectl get pods and confirm that the Pod named web-pod has the status Running. Write a print statement that outputs exactly: web-pod is Running if the Pod is running.
Kubernetes
Need a hint?

Use print("web-pod is Running") to show the Pod status confirmation.