-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: 无法通过指定 label 收集 pod 容器中控制台日志 #1450
Comments
你好,我最近也在研究这块,但是我发现我自己构造的pod的label都能够从业务容器+sandbox中拿到pod创建时的label,但是如果是pod已经存活后再添加的label就拿不到了。请问你的这个情况是pod创建时就已经有这些label了吗 |
containerd 从业务容器和pause容器也能拿到pod创建时的label |
没注意,不过有可能是你说的这种情况。 |
如果是后添加的,感觉只能从k8s api-server那里拿了。容器运行时没办法获取 |
我看了下你们是如何通过采集配置文件中的
IncludeK8sLabel
字段找到与之匹配的容器的具体实现,发现是先通过容器的详细信息(通过docker inspect [container-id]
获取)中的Labels
字段中的io.kubernetes.pod.namespace
和io.kubernetes.pod.name
字段找到与业务容器在同一个 pod 的 pause 容器,然后通过 pause 容器的详细信息中的Labels
字段来确定目标容器信息的,但是我现在发现一个问题:并不是所有 pod 的 label 都会出现在对应的 pause 容器中的,因此对应容器的日志也就无法采集,请看下面:采集配置文件:
待采集日志的 pod 的信息:
首先根据 pod 的名字到对应宿主机上找到相关容器:
接着检查 pause 容器中的 Labels信息:
可以看到
clickhouse.radondb.com/app: chop
和clickhouse.radondb.com/chop: dev-version
这两个 pod 中的 labels 并没有出现在 pause 容器中,同样也没有出现在对应的业务容器中:我也在使用了
containerd
运行时的k8s集群中尝试了一遍,同样的应用,对应的 pause 容器中也没有clickhouse.radondb.com/app: chop
和clickhouse.radondb.com/chop: dev-version
这两个 labels,同样业务容器中也没有。iLogtail版本:v1.8.4
k8s版本:v1.21.14
宿主机系统版本:
The text was updated successfully, but these errors were encountered: