You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RUN chmod -R 666 /var/log/
RUN chown -R fluent:fluent /var/log/
RUN chmod -R 777 /fluentd/
RUN chown -R fluent:fluent /fluentd/
RUN chmod -R 777 /home/fluent
RUN chown -R fluent:fluent /home/fluent
USER fluent
ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"]
CMD ["fluentd"]
But getting below error in fluentd pod.
Permission denied @ rb_sysopen - /var/log/containers.pos
Solutions tried so far:
Init containers to change permissions of /var/log. But new log files are getting added with root user.
Creating pos file inside pod at location /home/fluent/containers.pos but in this approach log files are not readable.
Please help!
The text was updated successfully, but these errors were encountered:
@prashantcsutar@davidcmitchell Have you guys been able to find a solution to this problem?
I want to solve it without having to interfere with the host level user permissions.
I'm planning to support Linux capability on Fluentd.
On /var/log case, we can attach cap_dac_override into /usr/local/bin/ruby and then Fluentd can write position file destination without root user.
ref: https://man7.org/linux/man-pages/man7/capabilities.7.html
For tailing files, I'd registered a PR to handle bypass file permission checking in in_tail with non-root user and cap_dac_read_search or cap_dac_override: fluent/fluentd#3155
I created a customized image for my project.
Dockerfile:
FROM fluent/fluentd:v1.4.2-debian-2.0
USER root
WORKDIR /home/fluent
ENV PATH /fluentd/vendor/bundle/ruby/2.6.0/bin:$PATH
ENV GEM_PATH /fluentd/vendor/bundle/ruby/2.6.0
ENV GEM_HOME /fluentd/vendor/bundle/ruby/2.6.0
ENV FLUENTD_DISABLE_BUNDLER_INJECTION 1
COPY Gemfile* /fluentd/
RUN buildDeps="sudo make gcc g++ libc-dev libffi-dev"
&& apt-get update
&& apt-get upgrade -y
&& apt-get install
-y --no-install-recommends
$buildDeps net-tools
&& gem install bundler --version 1.16.2
&& bundle config silence_root_warning true
&& bundle install --gemfile=/fluentd/Gemfile --path=/fluentd/vendor/bundle
&& SUDO_FORCE_REMOVE=yes
apt-get purge -y --auto-remove
-o APT::AutoRemove::RecommendsImportant=false
$buildDeps
&& rm -rf /var/lib/apt/lists/*
&& gem sources --clear-all
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems//cache/.gem
COPY ./conf/fluent.conf /fluentd/etc/
COPY ./conf/systemd.conf /fluentd/etc/
COPY ./conf/kubernetes.conf /fluentd/etc/
COPY ./conf/prometheus.conf /fluentd/etc/
RUN touch /fluentd/etc/disable.conf
COPY plugins /fluentd/plugins/
COPY entrypoint.sh /fluentd/entrypoint.sh
ENV FLUENTD_OPT=""
ENV FLUENTD_CONF="fluent.conf"
RUN chmod -R 666 /var/log/
RUN chown -R fluent:fluent /var/log/
RUN chmod -R 777 /fluentd/
RUN chown -R fluent:fluent /fluentd/
RUN chmod -R 777 /home/fluent
RUN chown -R fluent:fluent /home/fluent
USER fluent
ENTRYPOINT ["tini", "--", "/fluentd/entrypoint.sh"]
CMD ["fluentd"]
But getting below error in fluentd pod.
Permission denied @ rb_sysopen - /var/log/containers.pos
Solutions tried so far:
Please help!
The text was updated successfully, but these errors were encountered: