在Linux Kubernetes(K8S)环境中进行故障排查,可以遵循以下步骤和策略:
kubectl get pods --all-namespaces
kubectl get nodes
kubectl get events --sort-by=.metadata.creationTimestamp
kubectl logs <pod-name> -n <namespace>
kubectl logs <pod-name> -c <container-name> -n <namespace>
kubectl describe pod <pod-name> -n <namespace>
kubectl top pod -n <namespace>
kubectl top node
kubectl describe pvc <pvc-name> -n <namespace>
kubectl get networkpolicy -n <namespace>
kubectl get svc -n <namespace>
kubectl get ingress -n <namespace>
kubectl get deployment -n <namespace>
kubectl get rs -n <namespace>
kubectl get configmap -n <namespace>
kubectl get secrets -n <namespace>
kubectl exec -it <pod-name> -c <container-name> -- /bin/sh
kubectl debug -it <pod-name> -n <namespace> --image=busybox --target=<container-name>
kubectl get events --all-namespaces
kubectl get events --namespace=<namespace>
systemctl status kube-apiserver
systemctl status kube-controller-manager
systemctl status kube-scheduler
etcdctl member list
etcdctl get <key>
kubectl version
cat /etc/kubernetes/admin.conf
通过以上步骤和策略,可以有效地进行Linux Kubernetes环境的故障排查。