Base Fluentd image off debian:stretch-slim for systemd with LZ4

pull/6/head
Arve Knudsen 2017-08-15 14:09:18 +02:00
parent 6dc567abb9
commit 7e3b8a59dc
6 changed files with 68 additions and 18 deletions

View File

@ -48,11 +48,11 @@ roleRef:
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: DaemonSet kind: DaemonSet
metadata: metadata:
name: fluentd-es name: fluentd-es-v2.0.1
namespace: kube-system namespace: kube-system
labels: labels:
k8s-app: fluentd-es k8s-app: fluentd-es
version: v2.0.0 version: v2.0.1
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
addonmanager.kubernetes.io/mode: Reconcile addonmanager.kubernetes.io/mode: Reconcile
spec: spec:
@ -61,7 +61,7 @@ spec:
labels: labels:
k8s-app: fluentd-es k8s-app: fluentd-es
kubernetes.io/cluster-service: "true" kubernetes.io/cluster-service: "true"
version: v2.0.0 version: v2.0.1
# This annotation ensures that fluentd does not get evicted if the node # This annotation ensures that fluentd does not get evicted if the node
# supports critical pod annotation based priority scheme. # supports critical pod annotation based priority scheme.
# Note that this does not guarantee admission on the nodes (#40573). # Note that this does not guarantee admission on the nodes (#40573).
@ -71,7 +71,7 @@ spec:
serviceAccountName: fluentd-es serviceAccountName: fluentd-es
containers: containers:
- name: fluentd-es - name: fluentd-es
image: gcr.io/google-containers/fluentd-elasticsearch:v2.0.0 image: gcr.io/google-containers/fluentd-elasticsearch:v2.0.1
env: env:
- name: FLUENTD_ARGS - name: FLUENTD_ARGS
value: --no-supervisor -q value: --no-supervisor -q

View File

@ -19,8 +19,10 @@
# Note that fluentd is run with root permssion to allow access to # Note that fluentd is run with root permssion to allow access to
# log files with root only access under /var/log/containers/* # log files with root only access under /var/log/containers/*
FROM gcr.io/google-containers/debian-base-amd64:0.1 FROM debian:stretch-slim
COPY clean-apt /usr/bin
COPY clean-install /usr/bin
COPY Gemfile /Gemfile COPY Gemfile /Gemfile
# 1. Install & configure dependencies. # 1. Install & configure dependencies.
@ -31,18 +33,13 @@ RUN BUILD_DEPS="make gcc g++ libc6-dev ruby-dev" \
&& clean-install $BUILD_DEPS \ && clean-install $BUILD_DEPS \
ca-certificates \ ca-certificates \
libjemalloc1 \ libjemalloc1 \
liblz4-1 \
ruby \ ruby \
&& echo 'gem: --no-document' >> /etc/gemrc \ && echo 'gem: --no-document' >> /etc/gemrc \
&& gem install --file Gemfile \ && gem install --file Gemfile \
&& apt-get purge -y --auto-remove \ && apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \ -o APT::AutoRemove::RecommendsImportant=false \
$BUILD_DEPS \ $BUILD_DEPS \
&& rm -rf /tmp/* \ && clean-apt \
/var/lib/apt/lists/* \
/usr/lib/ruby/gems/*/cache/*.gem \
/var/log/* \
/var/tmp/* \
# Ensure fluent has enough file descriptors # Ensure fluent has enough file descriptors
&& ulimit -n 65536 && ulimit -n 65536

View File

@ -16,7 +16,7 @@
PREFIX = gcr.io/google-containers PREFIX = gcr.io/google-containers
IMAGE = fluentd-elasticsearch IMAGE = fluentd-elasticsearch
TAG = v2.0.0 TAG = v2.0.1
build: build:
docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) . docker build --pull -t $(PREFIX)/$(IMAGE):$(TAG) .

View File

@ -0,0 +1,29 @@
#!/bin/sh
# Copyright 2017 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.
# A script encapsulating a common Dockerimage pattern for installing packages
# and then cleaning up the unnecessary install artifacts.
# e.g. clean-install iptables ebtables conntrack
set -o errexit
apt-get clean -y
rm -rf \
/var/cache/debconf/* \
/var/lib/apt/lists/* \
/var/log/* \
/tmp/* \
/var/tmp/*

View File

@ -0,0 +1,30 @@
#!/bin/sh
# Copyright 2017 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.
# A script encapsulating a common Dockerimage pattern for installing packages
# and then cleaning up the unnecessary install artifacts.
# e.g. clean-install iptables ebtables conntrack
set -o errexit
if [ $# = 0 ]; then
echo >&2 "No packages specified"
exit 1
fi
apt-get update
apt-get install -y --no-install-recommends $@
clean-apt

View File

@ -20,10 +20,4 @@
# For systems without journald # For systems without journald
mkdir -p /var/log/journal mkdir -p /var/log/journal
# Copy host libsystemd into image to avoid compatibility issues.
if [ ! -z "$(ls /host/lib/libsystemd* 2>/dev/null)" ]; then
rm /lib/x86_64-linux-gnu/libsystemd*
cp -a /host/lib/libsystemd* /lib/x86_64-linux-gnu/
fi
/usr/local/bin/fluentd $@ /usr/local/bin/fluentd $@