Remove the `logger` container from the logging daemonset. Remove the outgoing call from the poolmgr to the logger. Use Fluentd's Kubernetes filter to add function name and UID to influx metadata. This means fluentd now figures out when to start collecting function logs on its own, without being informed by poolmgr. This is great for other execution strategies, and for autoscaling, where fission isn't in direct control of function pod creation. Also adds an integration test to make sure logging keeps working.
71 lines
3.1 KiB
Docker
71 lines
3.1 KiB
Docker
# This file originally came from official Kubernetes GitHub repository.
|
|
# You can reach original file with the following link:
|
|
# https://github.com/kubernetes/kubernetes/tree/42fbf93fb0bb48d0592e2aa08c5ce6d28ab6d4b0/cluster/addons/fluentd-gcp/fluentd-gcp-image
|
|
|
|
# Modification:
|
|
# 1. add plugin "fluent-plugin-influxdb" for influxdb support
|
|
|
|
# Copyright 2016 The Kubernetes Authors.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# This Dockerfile will build an image that is configured
|
|
# to use Fluentd to collect all Docker container log files
|
|
# and then cause them to be ingested using the Google Cloud
|
|
# Logging API. This configuration assumes that the host performning
|
|
# the collection is a VM that has been created with a logging.write
|
|
# scope and that the Logging API has been enabled for the project
|
|
# in the Google Developer Console.
|
|
|
|
FROM gcr.io/google_containers/ubuntu-slim:0.6
|
|
|
|
|
|
# Disable prompts from apt
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
# Install build tools
|
|
RUN apt-get -qq update && \
|
|
apt-get install -y -qq curl ca-certificates gcc g++ make bash sudo && \
|
|
apt-get install -y -qq --reinstall lsb-base lsb-release && \
|
|
# Install logging agent and required gems
|
|
/usr/bin/curl -sSL https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent2.sh | sh && \
|
|
sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent && \
|
|
td-agent-gem install --no-document fluent-plugin-record-reformer -v 0.8.2 && \
|
|
td-agent-gem install --no-document fluent-plugin-systemd -v 0.0.5 && \
|
|
td-agent-gem install --no-document fluent-plugin-google-cloud -v 0.5.2 && \
|
|
td-agent-gem install --no-document fluent-plugin-detect-exceptions -v 0.0.4 && \
|
|
td-agent-gem install --no-document fluent-plugin-influxdb && \
|
|
td-agent-gem install --no-document fluent-plugin-kubernetes_metadata_filter && \
|
|
td-agent-gem install --no-document fluent-plugin-flatten-hash && \
|
|
# Remove build tools
|
|
apt-get remove -y -qq gcc make && \
|
|
apt-get autoremove -y -qq && \
|
|
apt-get clean -qq && \
|
|
# Remove unnecessary files
|
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
|
/opt/td-agent/embedded/share/doc \
|
|
/opt/td-agent/embedded/share/gtk-doc \
|
|
/opt/td-agent/embedded/lib/postgresql \
|
|
/opt/td-agent/embedded/bin/postgres \
|
|
/opt/td-agent/embedded/share/postgresql \
|
|
/etc/td-agent/td-agent.conf
|
|
|
|
# Copy the Fluentd configuration file for logging Docker container logs.
|
|
COPY fluent.conf /etc/td-agent/td-agent.conf
|
|
|
|
# Copy the entrypoint for the container
|
|
COPY run.sh /run.sh
|
|
|
|
# Start Fluentd to pick up our config that watches Docker container logs.
|
|
CMD /run.sh $FLUENTD_ARGS
|