Kubernetes is essential for container orchestration. Here are the top 10 most used Kubernetes commands to help you manage your clusters efficiently:
kubectl get: Display a list of resources in your cluster.
🌱 kubectl get pods
kubectl describe: Show detailed information about a specific resource, including events and status.
🌱 kubectl describe pod [pod_name]
kubectl logs: Retrieve and display the logs from a container within a pod.
🌱 kubectl logs [pod_name]
kubectl apply: Apply a configuration file to create or update resources.
🌱 kubectl apply -f [filename]
kubectl delete: Remove resources from your cluster by name, type, or label selector.
🌱 kubectl delete pod [pod_name]
kubectl exec: Execute a command directly inside a running container.
🌱 kubectl exec -it [pod_name] -- [command]
kubectl config: View and modify kubeconfig files, which define cluster access settings.
🌱 kubectl config view
kubectl scale: Adjust the number of replicas for a deployment, replica set, or stateful set.
🌱 kubectl scale --replicas=[number] deployment/[deployment_name]
kubectl port-forward: Forward one or more local ports to a port on a pod, allowing access to internal services.
🌱 kubectl port-forward [pod_name] [local_port]:[pod_port]
kubectl rollout: Manage the rollout of a deployment, including checking status and undoing changes.
🌱 kubectl rollout status deployment/[deployment_name]
What are your favorite Kubernetes commands? Share in the comments!
Top comments (0)