← All notes

kubectl basics

Answer: kubectl is the Kubernetes command-line tool for talking to a cluster's control plane through the API. It reads cluster and credential settings from a kubeconfig file, by default ~/.kube/config or the KUBECONFIG variable.

Everyday commands

kubectl get pods -A
kubectl describe pod web-0
kubectl logs deploy/web -f
kubectl apply -f app.yaml
kubectl delete -f app.yaml
kubectl exec -it web-0 -- sh
kubectl port-forward svc/web 8080:80

Contexts

kubectl config get-contexts
kubectl config use-context staging
kubectl config set-context --current --namespace=dev

Productivity

source <(kubectl completion bash)
alias k=kubectl
complete -o default -F __start_kubectl k

Tips

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Kubernetes Authors, Command line tool (kubectl), CC BY 4.0 (kubernetes/website); Kubernetes Authors, kubectl Quick Reference, CC BY 4.0 (kubernetes/website).

Cite this

Permanent ID: iil:note:1bcx1y08

iinventedlight. 2026. "kubectl basics." iinventedlight Library, iil:note:1bcx1y08, version of 2026-11-04. https://iinventedlight.com/library/notes/kubernetes-kubectl-basics/. License: CC-BY-4.0.

@misc{iil_note_1bcx1y08,
  author = {{iinventedlight}},
  title = {{kubectl basics}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-04},
  url = {https://iinventedlight.com/library/notes/kubernetes-kubectl-basics/},
  note = {Permanent ID iil:note:1bcx1y08. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/kubernetes-kubectl-basics.md.