mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #2217 from satnam6502/fluentd-gcp-image
Make Fluentd to GCP Logging image self-contained
This commit is contained in:
commit
30e627ee08
@ -3,34 +3,32 @@
|
||||
# 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.
|
||||
# scope and that the Logging API has been enabled for the project
|
||||
# in the Google Developer Console.
|
||||
|
||||
FROM ubuntu:14.04
|
||||
MAINTAINER Satnam Singh "satnam@google.com"
|
||||
|
||||
# Ensure there are enough file descriptors for running Fluentd.
|
||||
RUN ulimit -n 65536
|
||||
# Disable prompts from apt.
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV OPTS_APT -y --force-yes --no-install-recommends
|
||||
|
||||
# Install prerequisites.
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl && \
|
||||
apt-get install -y -q libcurl4-openssl-dev make && \
|
||||
RUN apt-get -q update && \
|
||||
apt-get -y install apt-utils adduser && \
|
||||
apt-get clean
|
||||
|
||||
# Install Fluentd.
|
||||
RUN /usr/bin/curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
|
||||
ADD google-fluentd_1.0.0-0_amd64.deb /etc/google-fluentd/pkg/google-fluentd_1.0.0-0_amd64.deb
|
||||
RUN dpkg -i /etc/google-fluentd/pkg/google-fluentd_1.0.0-0_amd64.deb
|
||||
RUN /opt/google-fluentd/embedded/bin/gem install google-api-client
|
||||
ADD out_google_cloud.rb /etc/google-fluentd/plugin/out_google_cloud.rb
|
||||
ADD agent.conf /etc/google-fluentd/google-fluentd.conf
|
||||
COPY catch-all-inputs.tar.gz /tmp/catch-all-inputs.tar.gz
|
||||
RUN tar -C /etc/google-fluentd -zxf /tmp/catch-all-inputs.tar.gz
|
||||
RUN sed -i~ -e "s/\(USER\|GROUP\)=google-fluentd/\1=root/;" /etc/init.d/google-fluentd
|
||||
RUN sed -i~ -e 's/ --use-v1-config//' /etc/init.d/google-fluentd
|
||||
|
||||
# Change the default user and group to root.
|
||||
# Needed to allow access to /var/log/docker/... files.
|
||||
RUN sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent
|
||||
# Supress use of V1 config.
|
||||
RUN sed -i~ -e 's/ --use-v1-config//' /etc/init.d/td-agent
|
||||
# Copy the Fluentd configuration file for logging Docker container logs.
|
||||
COPY google-fluentd.conf /etc/google-fluentd/google-fluentd.conf
|
||||
|
||||
# Install GCP logging plug-in for Fluentd.
|
||||
RUN gsutil cp gs://signals-agents/out_google_cloud.rb /etc/td-agent/plugin
|
||||
|
||||
# Copy the Fluentd configuration file.
|
||||
COPY td-agent.conf /etc/td-agent/td-agent.conf
|
||||
|
||||
# Run Fluentd in the foreground.
|
||||
ENTRYPOINT ["/usr/sbin/td-agent"]
|
||||
# Start Fluentd to pick up our config that watches Docker container logs.
|
||||
CMD /usr/sbin/google-fluentd > /var/log/google-fluentd.log
|
13
contrib/logging/fluentd-gcp-image/Makefile
Normal file
13
contrib/logging/fluentd-gcp-image/Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
# The build rule builds a Docker image that logs all Docker contains logs to
|
||||
# Google Compute Platform using the Cloud Logging API. The push rule pushes
|
||||
# the image to DockerHub.
|
||||
# Satnam Singh (satnam@google.com)
|
||||
|
||||
.PHONY: build push
|
||||
|
||||
build:
|
||||
sudo docker build -t kubernetes/fluentd-gcp .
|
||||
|
||||
push:
|
||||
sudo docker push kubernetes/fluentd-gcp
|
||||
|
@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
# Build the fluentd-gcp image.
|
||||
sudo docker build -t kubernetes/fluentd-gcp .
|
@ -17,6 +17,7 @@
|
||||
format none
|
||||
time_key time
|
||||
path /var/lib/docker/containers/*/*-json.log
|
||||
pos_file /var/lib/docker/containers/containers.log.pos
|
||||
time_format %Y-%m-%dT%H:%M:%S
|
||||
tag docker.container.*
|
||||
</source>
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
sudo docker push kubernetes/fluentd-gcp
|
Loading…
Reference in New Issue
Block a user