在Debian系统上监控K8s运行状态,可使用以下工具和方法:
kubectl命令行工具
kubectl get nodes、kubectl get pods --all-namespaces、kubectl get deployments --all-namespaces。kubectl logs <pod-name> -n <namespace>。Kubernetes Dashboard
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml。http://<node-ip>:<dashboard-port>,使用默认用户名/密码(通常为admin/admin)。Prometheus + Grafana
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml。kubectl apply -f https://raw.githubusercontent.com/grafana/loki/v2.4.0/clients/manifests/kubernetes/loki-stack.yaml。http://<node-ip>:3000,配置Prometheus数据源后查看监控指标。cAdvisor
http://<node-ip>:8080/metrics。第三方工具
注意事项:
~/.kube/config文件)。