我已经部署了一个fluentd侧面容器和我的应用程序在一个荚收集日志从我的应用程序。
这是我的侧舱单sidecar.yaml
spec:
template:
spec:
containers:
- name: fluentd
image: fluent/fluentd
ports:
- containerPort: 24224
protocol: TCP
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
memory: 200Mi
requests:
cpu: 100m
memory: 200Mi
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /etc/td-agent/config.d
name: configmap-sidecar-volume
securityContext:
runAsUser: 101
runAsGroup: 101我使用这个清单并使用以下命令将其修补到我的部署中:
kubectl patch deployment my-deployment --patch “$(cat sidecar.yaml)”部署已成功更新,但是,my容器似乎无法启动并引发以下错误:
2020-10-16 09:07:07 +0000 [info]: parsing config file is succeeded path="/fluentd/etc/fluent.conf"
2020-10-16 09:07:08 +0000 [info]: gem 'fluentd' version '1.11.2'
2020-10-16 09:07:08 +0000 [warn]: [output_docker1] 'time_format' specified without 'time_key', will be ignored
2020-10-16 09:07:08 +0000 [error]: config error file="/fluentd/etc/fluent.conf" error_class=Fluent::ConfigError error="out_file: `/fluentd/log/docker.20201016.log` is not writable"这是我的fluent.conf文件:
<source>
@type forward
bind 127.0.0.1
port 24224
<parse>
@type json
</parse>
</source>是什么引起了这个问题?
发布于 2020-10-16 09:45:03
fluentd的UID默认为1000,除非它通过env FLUENT_UID更改。
/fluentd/log/docker.20201016.log is not writable -错误说明您的用户101没有对日志文件的写权限。将安全上下文更改为1000或设置env FLUENT_UID=101以修复此问题。
spec:
template:
spec:
containers:
- name: fluentd
image: fluent/fluentd
ports:
- containerPort: 24224
protocol: TCP
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
memory: 200Mi
requests:
cpu: 100m
memory: 200Mi
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /etc/td-agent/config.d
name: configmap-sidecar-volume
securityContext:
runAsUser: 1000
runAsGroup: 1000相关资源:
https://stackoverflow.com/questions/64386445
复制相似问题