Merge pull request #29883 from aledbf/fluent-image-size

Automatic merge from submit-queue

Reduce size of images fluentd-gcp and fluentd-elasticsearch

replaces #26652

```
aledbf/fluentd-elasticsearch                   1.19 769ece5c8ba8 About an hour ago 269.9 MB
gcr.io/google_containers/fluentd-elasticsearch 1.18 0a8cbfbea7f7 5 weeks ago       530.3 MB

aledbf/fluentd-gcp                             1.22 ef979b82a767 About an hour ago 307.9 MB
gcr.io/google_containers/fluentd-gcp           1.21 0ef09b1bcfd7 2 weeks ago       498.5 MB
```

closes #29782
pull/6/head
Kubernetes Submit Queue 2016-08-23 05:51:44 -07:00 committed by GitHub
commit e5fbea62c6
6 changed files with 72 additions and 35 deletions

View File

@ -22,7 +22,7 @@
# Please see http://docs.fluentd.org/articles/install-by-deb for more
# information about installing fluentd using deb package.
FROM ubuntu:14.04
FROM gcr.io/google_containers/ubuntu-slim:0.4
MAINTAINER Alex Robinson "arob@google.com"
MAINTAINER Jimmi Dyson "jimmidyson@gmail.com"
@ -32,24 +32,11 @@ RUN ulimit -n 65536
# Disable prompts from apt.
ENV DEBIAN_FRONTEND noninteractive
# Install prerequisites.
RUN apt-get update && \
apt-get install -y -q curl make g++ && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Fluentd.
RUN /usr/bin/curl -L https://td-toolbelt.herokuapp.com/sh/install-ubuntu-trusty-td-agent2.sh | sh
# 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
# Install the Elasticsearch Fluentd plug-in.
RUN td-agent-gem install fluent-plugin-kubernetes_metadata_filter fluent-plugin-elasticsearch
# Copy the Fluentd configuration file.
COPY td-agent.conf /etc/td-agent/td-agent.conf
COPY build.sh /tmp/build.sh
RUN /tmp/build.sh
# Run the Fluentd service.
ENTRYPOINT ["td-agent"]

View File

@ -15,7 +15,7 @@
.PHONY: build push
IMAGE = fluentd-elasticsearch
TAG = 1.17
TAG = 1.19
build:
docker build -t gcr.io/google_containers/$(IMAGE):$(TAG) .

View File

@ -0,0 +1,47 @@
#!/bin/sh
# Copyright 2015 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.
# Install prerequisites.
apt-get update
apt-get install -y -q --no-install-recommends \
curl ca-certificates make g++ sudo bash
# Install Fluentd.
/usr/bin/curl -sSL https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent2.sh | sh
# Change the default user and group to root.
# Needed to allow access to /var/log/docker/... files.
sed -i -e "s/USER=td-agent/USER=root/" -e "s/GROUP=td-agent/GROUP=root/" /etc/init.d/td-agent
# Install the Elasticsearch Fluentd plug-in.
# http://docs.fluentd.org/articles/plugin-management
td-agent-gem install --no-document fluent-plugin-kubernetes_metadata_filter -v 0.24.0
td-agent-gem install --no-document fluent-plugin-elasticsearch -v 1.5.0
# Remove docs and postgres references
rm -rf /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
apt-get remove -y make g++
apt-get autoremove -y
apt-get clean -y
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@ -218,9 +218,9 @@
tag kube-scheduler
</source>
<filter kubernetes.**>
type kubernetes_metadata
</filter>
#<filter kubernetes.**>
# type kubernetes_metadata
#</filter>
# Example:
# I0603 15:31:05.793605 6 cluster_manager.go:230] Reading config from path /etc/gce.conf

View File

@ -20,7 +20,7 @@
# scope and that the Logging API has been enabled for the project
# in the Google Developer Console.
FROM ubuntu:16.04
FROM gcr.io/google_containers/ubuntu-slim:0.4
MAINTAINER Alex Robinson "arob@google.com"
# Disable prompts from apt.
@ -29,19 +29,22 @@ ENV DEBIAN_FRONTEND noninteractive
ENV DO_NOT_INSTALL_CATCH_ALL_CONFIG true
RUN apt-get -q update && \
apt-get install -y curl && \
apt-get install -y gcc && \
apt-get install -y make && \
apt-get install -y curl ca-certificates gcc make bash && \
apt-get install -y --reinstall lsb-base lsb-release && \
echo "Installing logging agent" && \
curl -sSL https://dl.google.com/cloudagents/install-logging-agent.sh | bash && \
/usr/sbin/google-fluentd-gem install fluent-plugin-record-reformer -v 0.8.1 && \
/usr/sbin/google-fluentd-gem install fluent-plugin-systemd -v 0.0.3 && \
apt-get remove -y gcc make && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
curl -s https://dl.google.com/cloudagents/install-logging-agent.sh | bash
# Install the record reformer and systemd plugins.
RUN /usr/sbin/google-fluentd-gem install fluent-plugin-record-reformer -v 0.8.1
RUN /usr/sbin/google-fluentd-gem install fluent-plugin-systemd -v 0.0.3
# Remove the misleading log file that gets generated when the agent is installed
RUN rm -rf /var/log/google-fluentd
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
/opt/google-fluentd/embedded/share/doc \
/opt/google-fluentd/embedded/share/gtk-doc \
/opt/google-fluentd/embedded/lib/postgresql \
/opt/google-fluentd/embedded/bin/postgres \
/opt/google-fluentd/embedded/share/postgresql \
/var/log/google-fluentd
# Copy the Fluentd configuration files for logging Docker container logs.
# Either configuration file can be used by specifying `-c <file>` as a command

View File

@ -28,7 +28,7 @@
.PHONY: kbuild kpush
TAG = 1.21
TAG = 1.25
# Rules for building the test image for deployment to Dockerhub with user kubernetes.