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:
kubectl create: Create a resource from a file or from stdin.
kubectl apply: Apply a configuration to a resource by filename or stdin.
kubectl get: Display one or many resources.
kubectl describe: Show details of a specific resource or group of resources.
kubectl delete: Delete resources by filenames, stdin, resources, and names, or by resources and label selector.
kubectl edit: Edit a resource on the server.
kubectl exec: Execute a command in a container.
kubectl logs: Print the logs for a container in a pod.
kubectl port-forward: Forward one or more local ports to a pod.
kubectl proxy: Run a proxy to the Kubernetes API server.
kubectl run: Run a particular image on the cluster.
kubectl set: Set specific features on objects.
kubectl expose: Take a replication controller, service, deployment, or pod and expose it as a new Kubernetes service.
kubectl scale: Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
kubectl autoscale: Auto-scale a Deployment, ReplicaSet, or Replication Controller.
kubectl rollout: Manage the rollout of a resource.
kubectl attach: Attach to a running container.
kubectl exec: Execute a command in a container.
kubectl expose: Take a replication controller, service, deployment, or pod and expose it as a new Kubernetes service.
kubectl get: Display one or many resources.
kubectl label: Update the labels on a resource.
kubectl logs: Print the logs for a container in a pod.
kubectl patch: Update field(s) of a resource using strategic merge patch.
kubectl replace: Replace a resource by filename or stdin.
kubectl rollout: Manage the rollout of a resource.
kubectl scale: Set a new size for a Deployment, ReplicaSet, Replication Controller, or Job.
kubectl set: Set specific features on objects.
kubectl top: Display Resource (CPU/Memory/Storage) usage.
kubectl api-resources: Print the supported API resources on the server.
kubectl api-versions: Print the supported API versions on the server.
kubectl cluster-info: Display cluster info.
kubectl config: Modify kubeconfig files.
kubectl plugin: Provides utilities for interacting with kubectl plugins.
kubectl version: Print the client and server version information.
kubectl auth: Inspect authorization.
kubectl certificate: Modify certificate resources.
kubectl completion: Output shell completion code for the specified shell (bash or zsh).
kubectl config: Modify kubeconfig files.
kubectl plugin: Provides utilities for interacting with kubectl plugins.
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.