Thuta Learning
BasicDevOpsintermediate

kubectl Basics

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand kubectl Basics without any of the intimidation
  • Get comfortable running kubectl commands and YAML yourself
  • Apply this concept right away in a real project

Take a moment to think about this

kubectl (commonly pronounced 'kube-control' or 'kube-cuttle') is a command line tool that controls the cluster by sending HTTP requests to the Control Plane's API Server — you can get/create/update/delete resources with it. Its command pattern follows `kubectl <verb> <resource-type> <resource-name>` — for example, `kubectl get pods` means 'show me all the pods'.

Let's connect this to a real scenario

You can list the nodes in your cluster with `kubectl get nodes`. You can view pods with `kubectl get pods` (it'll be empty the first time you run it, since you haven't created any pods yet). `kubectl describe <resource>` shows detailed info about a specific resource (including its event log and error messages) — it's the most helpful command when debugging.

Let's look at it together

bash
# See cluster nodes
kubectl get nodes

# See all pods in the current namespace
kubectl get pods

# See pods with more detail (IP, node, status)
kubectl get pods -o wide

# See detailed info + events for one pod
kubectl describe pod <pod-name>

# Check kubectl can talk to your cluster
kubectl cluster-info
You should see
NAME       STATUS   ROLES           AGE   VERSION
minikube   Ready    control-plane   5m    v1.29.0

5-minute try-it

Run `kubectl get nodes` and `kubectl cluster-info` on your local cluster and try to read through the output yourself.

A quick word of caution

By default, kubectl commands only act on your current context (the cluster you're connected to) — always double-check with `kubectl config current-context` so you don't accidentally mix up production and local clusters and send a command to the wrong one.

Easy traps

  • Running `kubectl get pods`, getting an empty result, and thinking 'something's broken' — an empty result is completely normal if you haven't created any pods yet
  • Skimming past kubectl's output and trying to debug errors without ever using the `describe` command

Now try it yourself

Run `kubectl get nodes` and `kubectl cluster-info` on your local cluster and try to read through the output yourself.

You'll know it worked when: NAME STATUS ROLES AGE VERSION minikube Ready control-plane 5m v1.29.0

kubectl Basics | Thuta Learning