Check out my new books that I just published...
Kubernetes offers a robust set of commands to help troubleshoot various issues within your clusters. By effectively using these commands, you can diagnose and resolve a wide range of issues within your Kubernetes clusters.
Here are some of the most useful:
kubectl get pods: Lists all pods in the cluster, including their status, namespace, and other relevant information.
kubectl describe pod <pod-name>: Provides detailed information about a specific pod, including its events, logs, and resource usage.
kubectl logs <pod-name>: Displays the logs of a specific pod.
kubectl describe service <service-name>: Provides information about a service, including its type, selector, and endpoints.
kubectl describe deployment <deployment-name>: Provides information about a deployment, including its desired, current, and up-to-date replicas.
kubectl get ingress: Lists Ingress resources in the cluster.
kubectl describe ingress <ingress-name>: Provides details about a specific Ingress resource.
kubectl get svc: Lists all services in the cluster.
kubectl get endpoints <service-name>: Lists the endpoints associated with a service.
kubectl get nodes: Lists all nodes in the cluster, including their status and conditions.
kubectl describe persistentvolume <pv-name>: Provides information about a PersistentVolume.
kubectl describe persistentvolumeclaim <pvc-name>: Provides information about a PersistentVolumeClaim.
kubectl get storageclasses: Lists all StorageClasses in the cluster.
kubectl get events: Lists all events in the cluster.
kubectl describe event <event-name>: Provides details about a specific event.
kubectl get configmap: Lists all ConfigMaps in the cluster.
kubectl get secret: Lists all Secrets in the cluster.
kubectl top pod <pod-name>: Shows resource usage metrics for a pod.
kubectl exec -it <pod-name> -- /bin/bash: Executes a shell within a pod for debugging.