简体   繁体   English

如何调试 Kubernetes 集群?

[英]How to debug a kubernetes cluster?

As the question shows, I have very low knowledge about kubernetes.正如问题所示,我对 kubernetes 的了解非常少。 Following a tutorial, I made a Kubernetes cluster to run a web app on a local server using Minikube.按照教程,我创建了一个 Kubernetes 集群,以使用 Minikube 在本地服务器上运行 Web 应用程序。 I have applied the kubernetes components and they are running but the Web-Server does not respond to HTTP requests.我已经应用了 kubernetes 组件并且它们正在运行,但是 Web 服务器不响应 HTTP 请求。 My problem is that all the system that I have created is like a black box for me and I have literally no idea how to open it and see where the problem is.我的问题是我创建的所有系统对我来说就像一个黑匣子,我真的不知道如何打开它并查看问题出在哪里。 Can you explain how I can debug such implementaions in a wise way.您能解释一下我如何以明智的方式调试此类实现吗? Thanks.谢谢。

use a tool like https://github.com/kubernetes/kubernetes-dashboard使用像https://github.com/kubernetes/kubernetes-dashboard这样的工具

You can install kubectl and kubernetes-dashboard in a k8s cluster ( https://kubernetes.io/docs/tasks/tools/install-kubectl/ ), and then use the kubectl command to query information about a pod or container, or use the kubernetes-dashboard web UI to query information about the cluster.您可以在 k8s 集群( https://kubernetes.io/docs/tasks/tools/install-kubectl/ )中安装 kubectl 和 kubernetes-dashboard,然后使用 kubectl 命令查询 pod 或容器的信息,或者使用用于查询集群信息的 kubernetes-dashboard Web UI。 For more information, please refer to https://kubernetes.io/更多信息请参考https://kubernetes.io/

kubectl get pods

will show you all your pods and their status.将显示您所有的 Pod 及其状态。 A quick check to make sure that all is at least running.快速检查以确保至少一切都在运行。

If there are pods that are unhealthy, then如果有不健康的豆荚,那么

kubectl describe pod <pod name>

will give some more information.. eg image not found etc将提供更多信息.. 例如找不到图像等

kubectl log <pod name> --all

is often the next step , use -f to follow the logs as you exercise your api.通常是下一步,在练习 api 时使用-f跟踪日志。

It is possible to link up images running in a pod with most ide debuggers, but instructions will differ depending on language and ide used...可以将 pod 中运行的图像与大多数 ide 调试器连接起来,但指令会因使用的语言和 ide 不同而有所不同...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM