Skip to content

kubectl quickstart

This guide assumes you’ve already set up your kubeconfig.

List the namespaces in your cluster:

Terminal window
kubectl get ns

You’ll see the built-in Kubernetes namespaces (default, kube-system, kube-public, kube-node-lease).

List pods in a namespace:

Terminal window
# pods in the default namespace
kubectl get pods
# pods across every namespace
kubectl get pods -A

Check the nodes backing your cluster:

Terminal window
kubectl get nodes -o wide

A quick smoke test:

Terminal window
kubectl create deployment hello-world --image=nginx
kubectl get pods -w

Once the pod reports Running, your cluster is serving workloads.

Next, expose a service to the internet over HTTPS with Ingress or the Gateway API.

Terminal window
kubectl delete deployment hello-world