0
0
Kubernetesdevops~30 mins

Why kubectl mastery matters in Kubernetes - See It in Action

Choose your learning style9 modes available
Why kubectl mastery matters
📖 Scenario: You are a new DevOps engineer starting to manage applications on Kubernetes clusters. You need to understand how to use kubectl, the command-line tool for Kubernetes, to interact with your cluster resources effectively.
🎯 Goal: Learn the basics of kubectl commands by creating a simple pod, checking its status, and listing pods in the cluster. This will help you gain confidence in managing Kubernetes resources.
📋 What You'll Learn
Create a YAML file defining a simple pod named my-pod running the nginx container
Use kubectl to create the pod from the YAML file
Use kubectl to check the status of my-pod
Use kubectl to list all pods in the default namespace
💡 Why This Matters
🌍 Real World
In real work, DevOps engineers use <code>kubectl</code> daily to deploy, monitor, and troubleshoot applications running on Kubernetes clusters.
💼 Career
Mastering <code>kubectl</code> commands is essential for roles like Kubernetes administrator, DevOps engineer, and cloud engineer to manage containerized applications effectively.
Progress0 / 4 steps
1
Create a pod YAML file
Create a file named my-pod.yaml with the exact content below to define a pod named my-pod running the nginx container:
apiVersion: v1
kind: Pod
metadata:
  name: my-pod
spec:
  containers:
  - name: nginx
    image: nginx
Kubernetes
Need a hint?

Make sure the file is named exactly my-pod.yaml and the indentation matches YAML format.

2
Create the pod using kubectl
Run the exact command kubectl apply -f my-pod.yaml to create the pod in your Kubernetes cluster.
Kubernetes
Need a hint?

Use kubectl apply -f followed by the YAML file name to create resources.

3
Check the pod status
Run the exact command kubectl get pod my-pod to see the status of the pod named my-pod.
Kubernetes
Need a hint?

Use kubectl get pod followed by the pod name to check its status.

4
List all pods in the default namespace
Run the exact command kubectl get pods to list all pods running in the default namespace.
Kubernetes
Need a hint?

Use kubectl get pods to see all pods. The output should show my-pod with status Running.