英文:
Why is the KubeEvents table empty in azure logs?
问题
简而言之:为什么我的KubeEvents查询为空,而kubectl get events
不为空?
因此,我的最终目标是将Kubernetes事件存储在Azure中,以找出为什么我们的Pod正在重新启动。
我可以通过kubectl get events
查询事件,但我的理解是这些日志仅保留一个小时。
我的具体问题是,当我查询kubectl get events
时,我收到了一个“warning”类型的事件,我希望在查询Azure日志中的KubeEvents时能看到。但当我查询KubeEvents时,没有结果。我确保查询的时间段应包含该事件。
我查看过的内容:
-
我在这个FAQ中阅读到,类型为“Normal”的事件不会被收集,但我的日志类型是“Warning”。
-
我正在研究添加诊断设置,但据我了解,KubeEvents与这些类别是分开的?老实说,我无法完全理解这些设置究竟在做什么,考虑到我对这个环境的陌生。
英文:
In short: Why would my query for KubeEvents be empty when kubectl get events
is not empty ?
So my end goal is to have azure store kubernetes events in order to figure out why our pods are restarting.
I can query the events via kubectl get events
however my understanding is these logs are only held for an hour.
My specific issue is when I query kubectl get events
, I receive an event of type 'warning' that I expect to see when I query KubeEvents in azure logs. But when I query KubeEvents, there are no results. I ensured the time period being queried should encompass the event.
What I've looked into
-
I've read in this faq how events with type "Normal" won't be collected, however my log has type "Warning"
-
I was looking into adding a Diagnostic Setting, but from what I can tell KubeEvents are separate from those categories ? Honestly I couldn't grok exactly what those settings were doing, the documentation felt vague considering my lack of familiarity with this environment.
答案1
得分: 1
我已创建了一个AKS集群并部署了一个示例应用程序来检查Kube事件。
当我在集群中运行kubectl get events
以获取有待状态的Pod的事件时,它会列出类型为warning
的事件,如下所示。
kubectl get events --field-selector involvedObject.kind=Pod | grep Warning
要在AKS中查看相同的事件,请在容器洞察中启用容器日志。
现在导航到AKS集群中的日志并查询kubeEvents。 KubeEvents | where ObjectKind contains "Pod"
英文:
I have created an AKS cluster and deployed a sample application to check the Kube events.
When I run kubectl get events
for pods in cluster, it lists type warning
for pods with pending status as below.
kubectl get events --field-selector involvedObject.kind=Pod | grep Warning
To see the same events in AKS, enable container logs in container insights.
Now navigate to logs in the AKS cluster and query kubeEvents. KubeEvents | where ObjectKind contains "Pod"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论