为什么 Azure 日志中的 KubeEvents 表为空?

huangapple go评论64阅读模式
英文:

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时,没有结果。我确保查询的时间段应包含该事件。


我查看过的内容:

  1. 我在这个FAQ中阅读到,类型为“Normal”的事件不会被收集,但我的日志类型是“Warning”。

  2. 我正在研究添加诊断设置,但据我了解,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

  1. I've read in this faq how events with type "Normal" won't be collected, however my log has type "Warning"

  2. 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.
为什么 Azure 日志中的 KubeEvents 表为空?

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

为什么 Azure 日志中的 KubeEvents 表为空?

To see the same events in AKS, enable container logs in container insights.

为什么 Azure 日志中的 KubeEvents 表为空?

Now navigate to logs in the AKS cluster and query kubeEvents. KubeEvents | where ObjectKind contains "Pod"

为什么 Azure 日志中的 KubeEvents 表为空?

huangapple
  • 本文由 发表于 2023年5月23日 01:43:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76308717.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定