Skip to content
Ku

Kubernetes

kubectl context, workload inspection, scaling, and debugging tools.

11 commandsk8skubectlclusters

Command catalog

Cluster contextKubernetes

kubectl config get-contexts

List kubeconfig contexts and highlight the active one.

kubectl config get-contexts
Cluster contextKubernetes

kubectl config set-context

Customize default namespaces or users for a context.

kubectl config set-context --current --namespace=<namespace>
Workload inspectionKubernetes

kubectl get pods

kubectl get deployments

List workloads with wide details or watch for changes.

kubectl get pods -n <namespace> -o wide
Workload inspectionKubernetes

kubectl describe

Inspect detailed resource metadata and events.

kubectl describe pod <pod> -n <namespace>
Workload inspectionKubernetes

kubectl logs

Stream container logs or view historical entries.

kubectl logs <pod> -c <container> -n <namespace>
Scaling and rolloutKubernetes

kubectl scale

Scale deployments, statefulsets, or replicasets to desired counts.

kubectl scale deployment <name> --replicas=<count>
Scaling and rolloutKubernetes

kubectl rollout

Monitor or rollback deployment rollouts.

kubectl rollout status deployment/<name>
Scaling and rolloutKubernetes

kubectl apply

Apply declarative configuration changes.

kubectl apply -f <manifest.yaml>
Diagnostics and port-forwardingKubernetes

kubectl exec

Run commands within containerized workloads.

kubectl exec -it <pod> -- /bin/sh
Diagnostics and port-forwardingKubernetes

kubectl port-forward

Forward local ports to pods or services for debugging.

kubectl port-forward deployment/<name> 8080:80
Diagnostics and port-forwardingKubernetes

kubectl top

Fetch resource metrics for nodes or pods.

kubectl top nodes