首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Fluentd无法将日志写入/fluentd/log Directory

Fluentd无法将日志写入/fluentd/log Directory
EN

Stack Overflow用户
提问于 2020-10-16 09:24:58
回答 1查看 1.7K关注 0票数 0

我已经部署了一个fluentd侧面容器和我的应用程序在一个荚收集日志从我的应用程序。

这是我的侧舱单sidecar.yaml

代码语言:javascript
复制
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

我使用这个清单并使用以下命令将其修补到我的部署中:

代码语言:javascript
复制
kubectl patch deployment my-deployment --patch “$(cat sidecar.yaml)”

部署已成功更新,但是,my容器似乎无法启动并引发以下错误:

代码语言:javascript
复制
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文件:

代码语言:javascript
复制
<source>
  @type forward
  bind 127.0.0.1
  port 24224
  <parse>
    @type json
  </parse>
</source>

是什么引起了这个问题?

EN

回答 1

Stack Overflow用户

发布于 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以修复此问题。

代码语言:javascript
复制
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

相关资源:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64386445

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档