mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #1610 from satnam6502/salt
Salt configuration for fluentd to Elasticsearch
This commit is contained in:
commit
23e42d3b99
@ -22,6 +22,7 @@ mkdir -p /srv/salt-overlay/pillar
|
|||||||
cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls
|
cat <<EOF >/srv/salt-overlay/pillar/cluster-params.sls
|
||||||
node_instance_prefix: $NODE_INSTANCE_PREFIX
|
node_instance_prefix: $NODE_INSTANCE_PREFIX
|
||||||
portal_net: $PORTAL_NET
|
portal_net: $PORTAL_NET
|
||||||
|
use-fluentd-es: $FLUENTD_ELASTICSEARCH
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p /srv/salt-overlay/salt/nginx
|
mkdir -p /srv/salt-overlay/salt/nginx
|
||||||
|
@ -264,6 +264,7 @@ function kube-up {
|
|||||||
echo "readonly SALT_TAR_URL='${SALT_TAR_URL}'"
|
echo "readonly SALT_TAR_URL='${SALT_TAR_URL}'"
|
||||||
echo "readonly MASTER_HTPASSWD='${htpasswd}'"
|
echo "readonly MASTER_HTPASSWD='${htpasswd}'"
|
||||||
echo "readonly PORTAL_NET='${PORTAL_NET}'"
|
echo "readonly PORTAL_NET='${PORTAL_NET}'"
|
||||||
|
echo "readonly FLUENTD_ELASTICSEARCH='${FLUENTD_ELASTICSEARCH:-false}'"
|
||||||
grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/create-dynamic-salt-files.sh"
|
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/download-release.sh"
|
||||||
grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/salt-master.sh"
|
grep -v "^#" "${KUBE_ROOT}/cluster/gce/templates/salt-master.sh"
|
||||||
|
21
cluster/saltbase/salt/fluentd-es/fluentd-es.manifest
Normal file
21
cluster/saltbase/salt/fluentd-es/fluentd-es.manifest
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
version: v1beta2
|
||||||
|
id: fluentd-to-elasticsearch
|
||||||
|
containers:
|
||||||
|
- name: fluentd-es
|
||||||
|
image: kubernetes/fluentd-elasticsearch
|
||||||
|
volumeMounts:
|
||||||
|
- name: containers
|
||||||
|
mountPath: /var/lib/docker/containers
|
||||||
|
readOnly: true
|
||||||
|
- name: hosts
|
||||||
|
mountPath: /outerhost
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: containers
|
||||||
|
source:
|
||||||
|
hostDir:
|
||||||
|
path: /var/lib/docker/containers
|
||||||
|
- name: hosts
|
||||||
|
source:
|
||||||
|
hostDir:
|
||||||
|
path: /etc/hosts
|
8
cluster/saltbase/salt/fluentd-es/init.sls
Normal file
8
cluster/saltbase/salt/fluentd-es/init.sls
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/etc/kubernetes/manifests/fluentd-es.manifest:
|
||||||
|
file.managed:
|
||||||
|
- source: salt://fluentd-es/fluentd-es.manifest
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: 644
|
||||||
|
- makedirs: true
|
||||||
|
- dir_mode: 755
|
@ -8,6 +8,9 @@ base:
|
|||||||
- kubelet
|
- kubelet
|
||||||
- kube-proxy
|
- kube-proxy
|
||||||
- cadvisor
|
- cadvisor
|
||||||
|
{% if pillar['use-fluentd-es'] is defined and pillar['use-fluentd-es'] %}
|
||||||
|
- fluentd-es
|
||||||
|
{% endif %}
|
||||||
# We need a binary release of nsinit
|
# We need a binary release of nsinit
|
||||||
# - nsinit
|
# - nsinit
|
||||||
- logrotate
|
- logrotate
|
||||||
@ -36,4 +39,3 @@ base:
|
|||||||
'roles:kubernetes-pool-vagrant':
|
'roles:kubernetes-pool-vagrant':
|
||||||
- match: grain
|
- match: grain
|
||||||
- vagrant
|
- vagrant
|
||||||
|
|
||||||
|
18
docs/getting-started-guides/logging.md
Normal file
18
docs/getting-started-guides/logging.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
## Logging
|
||||||
|
|
||||||
|
**Experimental work in progress.**
|
||||||
|
|
||||||
|
### Logging with Fluentd and Elastiscsearch
|
||||||
|
|
||||||
|
To enable logging of the stdout and stderr output of every Docker container in
|
||||||
|
a Kubernetes cluster set the shell environment
|
||||||
|
variable ``FLUENTD_ELASTICSEARCH`` to ``true`` e.g. in bash:
|
||||||
|
```
|
||||||
|
export FLUENTD_ELASTICSEARCH=true
|
||||||
|
```
|
||||||
|
This will instantiate a [Fluentd](http://www.fluentd.org/) instance on each node which will
|
||||||
|
collect all the Dcoker container log files. The collected logs will
|
||||||
|
be targetted at an [Elasticsearch](http://www.elasticsearch.org/) instance assumed to be running on the
|
||||||
|
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).
|
Loading…
Reference in New Issue
Block a user