Skip to content
BENIBIX Learn

kubectl

Infrastructure☸️ Container OrchestrationKubernetes

Also known as Kube Control, kubectl apply, kubectl get pods

The command-line tool for Kubernetes. It reads, creates and changes what runs in a cluster.

Think of it like

It is like a TV remote for Kubernetes. You press buttons here, and the cluster does the work.

Example

Emma sends her deployment file with one kubectl line. A moment later, kubectl shows her three pods are ready.

Why it matters

Almost every Kubernetes guide and fix starts with a kubectl line. It is the first tool to learn.

Definition

kubectl is the command-line tool for talking to a Kubernetes cluster. You type a command, and it sends the request to the control plane. kubectl get lists things, like pods or deployments. kubectl apply sends a file that describes what should run. kubectl logs shows what a container printed. It reads a small config file to know which cluster to talk to.

Example code

console
$ kubectl apply -f https://k8s.io/examples/controllers/nginx-deployment.yaml
deployment.apps/nginx-deployment created
One file goes in, and the cluster says it made the deployment. The pods start a moment later.
kubectl is the arrow on the left. It talks only to the control plane, never to the nodes.

Common mistake

Running a command against the wrong cluster. Check which one kubectl points at before you delete anything.

Key takeaways

  1. 1
    Talks to the brain. Every command goes to the control plane.
  2. 2
    Get, apply, logs. Look, change, then check what happened.
  3. 3
    Knows its cluster. A config file says where it points.