Essential Kubernetes Commands

Essential Kubernetes Commands

As of my last training data in March 2023, Kubernetes offers a wide range of commands for managing containerized applications and infrastructure. Here are 40 essential Kubernetes commands that are commonly used:

  1. kubectl create: Create a resource from a file or from stdin.

  2. kubectl apply: Apply a configuration to a resource by filename or stdin.

  3. kubectl get: Display one or many resources.

  4. kubectl describe: Show details of a specific resource or group of resources.

  5. kubectl delete: Delete resources by filenames, stdin, resources, and names, or by resources and label selector.

  6. kubectl edit: Edit a resource on the server.

  7. kubectl exec: Execute a command in a container.

  8. kubectl logs: Print the logs for a container in a pod.

  9. kubectl port-forward: Forward one or more local ports to a pod.

  10. kubectl proxy: Run a proxy to the Kubernetes API server.

  11. kubectl run: Run a particular image on the cluster.

  12. kubectl set: Set specific features on objects.

  13. kubectl expose: Take a replication controller, service, deployment, or pod and expose it as a new Kubernetes service.

  14. kubectl scale: Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.

  15. kubectl autoscale: Auto-scale a Deployment, ReplicaSet, or Replication Controller.

  16. kubectl rollout: Manage the rollout of a resource.

  17. kubectl attach: Attach to a running container.

  18. kubectl exec: Execute a command in a container.

  19. kubectl expose: Take a replication controller, service, deployment, or pod and expose it as a new Kubernetes service.

  20. kubectl get: Display one or many resources.

  21. kubectl label: Update the labels on a resource.

  22. kubectl logs: Print the logs for a container in a pod.

  23. kubectl patch: Update field(s) of a resource using strategic merge patch.

  24. kubectl replace: Replace a resource by filename or stdin.

  25. kubectl rollout: Manage the rollout of a resource.

  26. kubectl scale: Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.

  27. kubectl set: Set specific features on objects.

  28. kubectl top: Display Resource (CPU/Memory/Storage) usage.

  29. kubectl api-resources: Print the supported API resources on the server.

  30. kubectl api-versions: Print the supported API versions on the server.

  31. kubectl cluster-info: Display cluster info.

  32. kubectl config: Modify kubeconfig files.

  33. kubectl plugin: Provides utilities for interacting with kubectl plugins.

  34. kubectl version: Print the client and server version information.

  35. kubectl auth: Inspect authorization.

  36. kubectl certificate: Modify certificate resources.

  37. kubectl completion: Output shell completion code for the specified shell (bash or zsh).

  38. kubectl config: Modify kubeconfig files.

  39. kubectl plugin: Provides utilities for interacting with kubectl plugins.

  40. kubectl version: Print the client and server version information.

These commands cover a wide range of Kubernetes operations, from managing resources to inspecting cluster information. Always refer to the official Kubernetes documentation for the most up-to-date information on these commands and their usage.

Did you find this article valuable?

Support CloudOpsAcademy - Prashanth Katkam by becoming a sponsor. Any amount is appreciated!