diff --git a/cluster/gce/templates/create-dynamic-salt-files.sh b/cluster/gce/templates/create-dynamic-salt-files.sh index 713e1291b6d..0183e286007 100644 --- a/cluster/gce/templates/create-dynamic-salt-files.sh +++ b/cluster/gce/templates/create-dynamic-salt-files.sh @@ -23,6 +23,7 @@ cat </srv/salt-overlay/pillar/cluster-params.sls node_instance_prefix: $NODE_INSTANCE_PREFIX portal_net: $PORTAL_NET use-fluentd-es: $FLUENTD_ELASTICSEARCH +use-fluentd-gcp: $FLUENTD_GCP EOF mkdir -p /srv/salt-overlay/salt/nginx diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 201519ae823..706518f0009 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -265,11 +265,17 @@ function kube-up { echo "readonly MASTER_HTPASSWD='${htpasswd}'" echo "readonly PORTAL_NET='${PORTAL_NET}'" echo "readonly FLUENTD_ELASTICSEARCH='${FLUENTD_ELASTICSEARCH:-false}'" + echo "readonly FLUENTD_GCP='${FLUENTD_GCP:-false}'" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/create-dynamic-salt-files.sh" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/download-release.sh" grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/salt-master.sh" ) > "${KUBE_TEMP}/master-start.sh" + # For logging to GCP we need to enable some minion scopes. + if [ $FLUENTD_GCP == "true" ]; then + MINION_SCOPES="${MINION_SCOPES}, https://www.googleapis.com/auth/logging.write" + fi + gcutil addinstance "${MASTER_NAME}" \ --project "${PROJECT}" \ --norespect_terminal_width \ diff --git a/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.manifest b/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.manifest new file mode 100644 index 00000000000..07ab3a779e6 --- /dev/null +++ b/cluster/saltbase/salt/fluentd-gcp/fluentd-gcp.manifest @@ -0,0 +1,14 @@ +version: v1beta2 +id: fluentd-to-gcp +containers: + - name: fluentd-gcp-container + image: kubernetes/fluentd-gcp + volumeMounts: + - name: containers + mountPath: /var/lib/docker/containers + readOnly: true +volumes: + - name: containers + source: + hostDir: + path: /var/lib/docker/containers diff --git a/cluster/saltbase/salt/fluentd-gcp/init.sls b/cluster/saltbase/salt/fluentd-gcp/init.sls new file mode 100644 index 00000000000..9953bbd7fc5 --- /dev/null +++ b/cluster/saltbase/salt/fluentd-gcp/init.sls @@ -0,0 +1,8 @@ +/etc/kubernetes/manifests/fluentd-gcp.manifest: + file.managed: + - source: salt://fluentd-gcp/fluentd-gcp.manifest + - user: root + - group: root + - mode: 644 + - makedirs: true + - dir_mode: 755 diff --git a/cluster/saltbase/salt/top.sls b/cluster/saltbase/salt/top.sls index 75ec944943a..bd7e21c6aa2 100644 --- a/cluster/saltbase/salt/top.sls +++ b/cluster/saltbase/salt/top.sls @@ -10,6 +10,9 @@ base: - cadvisor {% if pillar['use-fluentd-es'] is defined and pillar['use-fluentd-es'] %} - fluentd-es +{% endif %} +{% if pillar['use-fluentd-gcp'] is defined and pillar['use-fluentd-gcp'] %} + - fluentd-gcp {% endif %} # We need a binary release of nsinit # - nsinit diff --git a/docs/getting-started-guides/logging.md b/docs/getting-started-guides/logging.md index c1eab6b0348..fe4bf7fcf97 100644 --- a/docs/getting-started-guides/logging.md +++ b/docs/getting-started-guides/logging.md @@ -16,3 +16,8 @@ be targetted at an [Elasticsearch](http://www.elasticsearch.org/) instance assum local node and accepting log information on port 9200. This can be accomplished by writing a pod specification and service sepecificaiton to define an Elasticsearch service (more informaiton to follow shortly in the contrib directory). + +### Logging with Fluentd and Google Compute Platform + +To enable logging of Docker contains in a cluster using Google Compute +Platfrom set the shell environment variable ``FLUENTD_GCP`` to ``true``. \ No newline at end of file