mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +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
|
# and then cause them to be ingested using the Google Cloud
|
||||||
# Logging API. This configuration assumes that the host performning
|
# Logging API. This configuration assumes that the host performning
|
||||||
# the collection is a VM that has been created with a logging.write
|
# 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
|
FROM ubuntu:14.04
|
||||||
MAINTAINER Satnam Singh "satnam@google.com"
|
MAINTAINER Satnam Singh "satnam@google.com"
|
||||||
|
|
||||||
# Ensure there are enough file descriptors for running Fluentd.
|
# Disable prompts from apt.
|
||||||
RUN ulimit -n 65536
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
ENV OPTS_APT -y --force-yes --no-install-recommends
|
||||||
|
|
||||||
# Install prerequisites.
|
RUN apt-get -q update && \
|
||||||
RUN apt-get update && \
|
apt-get -y install apt-utils adduser && \
|
||||||
apt-get install -y curl && \
|
|
||||||
apt-get install -y -q libcurl4-openssl-dev make && \
|
|
||||||
apt-get clean
|
apt-get clean
|
||||||
|
|
||||||
# Install Fluentd.
|
ADD google-fluentd_1.0.0-0_amd64.deb /etc/google-fluentd/pkg/google-fluentd_1.0.0-0_amd64.deb
|
||||||
RUN /usr/bin/curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
|
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.
|
# Copy the Fluentd configuration file for logging Docker container logs.
|
||||||
# Needed to allow access to /var/log/docker/... files.
|
COPY google-fluentd.conf /etc/google-fluentd/google-fluentd.conf
|
||||||
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
|
|
||||||
|
|
||||||
# Install GCP logging plug-in for Fluentd.
|
# Start Fluentd to pick up our config that watches Docker container logs.
|
||||||
RUN gsutil cp gs://signals-agents/out_google_cloud.rb /etc/td-agent/plugin
|
CMD /usr/sbin/google-fluentd > /var/log/google-fluentd.log
|
||||||
|
|
||||||
# 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"]
|
|
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
|
format none
|
||||||
time_key time
|
time_key time
|
||||||
path /var/lib/docker/containers/*/*-json.log
|
path /var/lib/docker/containers/*/*-json.log
|
||||||
|
pos_file /var/lib/docker/containers/containers.log.pos
|
||||||
time_format %Y-%m-%dT%H:%M:%S
|
time_format %Y-%m-%dT%H:%M:%S
|
||||||
tag docker.container.*
|
tag docker.container.*
|
||||||
</source>
|
</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