All Essential kubectl Commands for 2026: A Complete Guide
This article provides a concise, step‑by‑step reference of the most frequently used kubectl commands—including get, describe, logs, exec, apply, port‑forward, rollout, scale, and delete—showing exact syntax and typical use cases for managing Kubernetes resources.
Kubernetes is a core component of large‑scale architectures. Below is a detailed walkthrough of the most commonly used kubectl commands for development and operations (2026 edition).
1. View resources
List Pods: kubectl get pods List all resources: kubectl get all Typical scenarios: checking whether a service is running and inspecting Pod status.
2. Show detailed information
Describe a Pod: kubectl describe pod <pod-name> Provides Pod status, configuration, and event error messages—useful for troubleshooting Pod startup failures.
3. View logs
Show logs of a Pod: kubectl logs <pod-name> Follow logs in real time: kubectl logs -f <pod-name> Helps locate application exceptions and diagnose issues in a running environment.
4. Execute commands inside a container
Enter a Pod's shell: kubectl exec -it <pod-name> -- bash Allows file inspection, command execution, and debugging directly within the container.
5. Deploy or update applications
Apply a YAML manifest: kubectl apply -f <app.yaml> Creates or updates resources defined in the YAML, causing the Pod to run the new configuration.
6. Access a Pod locally
Forward a local port to a Pod: kubectl port-forward <app> 8080:8080 Enables local debugging and testing of services exposed by the Pod.
7. Manage rollouts
Check rollout status: kubectl rollout status deployment <app> Undo a rollout: kubectl rollout undo deployment <app> Supports gradual releases and quick version rollback.
8. Scale workloads
Adjust replica count:
kubectl scale deployment <app> --replicas=5Used to add instances or handle traffic spikes.
9. Delete resources
Delete a Pod: kubectl delete pod <app> Delete resources from a manifest: kubectl delete -f <app.yaml> Helps clean up environments and remove services.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Architect Chen
Sharing over a decade of architecture experience from Baidu, Alibaba, and Tencent.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
