Skip to content

Commit

Permalink
Add cluster logging with fluentd and elastic search
Browse files Browse the repository at this point in the history
  • Loading branch information
eparis committed Jun 30, 2015
1 parent 7d7d5d4 commit 3a78104
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 2 deletions.
3 changes: 3 additions & 0 deletions contrib/ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ flannel_prefix: 12
# room for 4096 nodes with 254 pods per node.
flannel_host_prefix: 24

# Set to false to disable logging with elasticsearch
cluster_logging: true

# Turn to false to disable cluster monitoring with heapster and influxdb
cluster_monitoring: true

Expand Down
14 changes: 14 additions & 0 deletions contrib/ansible/roles/kubernetes-addons/tasks/cluster-logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: LOGGING | Assures {{ kube_config_dir }}/addons/cluster-logging dir exists
file: path={{ kube_config_dir }}/addons/cluster-logging state=directory

- name: LOGGING | Download logging files from Kubernetes repo
get_url:
url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/addons/fluentd-elasticsearch/{{ item }}
dest="{{ kube_config_dir }}/addons/cluster-logging/"
force=yes
with_items:
- es-controller.yaml
- es-service.yaml
- kibana-controller.yaml
- kibana-service.yaml
4 changes: 4 additions & 0 deletions contrib/ansible/roles/kubernetes-addons/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
- include: cluster-monitoring.yml
when: cluster_monitoring

- include: cluster-logging.yml
when: cluster_logging

#- name: Get kube-addons script from Kubernetes
# get_url:
# url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/saltbase/salt/kube-addons/kube-addons.sh
Expand All @@ -42,6 +45,7 @@
with_items:
- "system:dns"
- "system:monitoring"
- "system:logging"
register: gentoken
changed_when: "'Added' in gentoken.stdout"
notify:
Expand Down
4 changes: 4 additions & 0 deletions contrib/ansible/roles/kubernetes/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ kube_cert_dir: "{{ kube_config_dir }}/certs"
# This is where all of the bearer tokens will be stored
kube_token_dir: "{{ kube_config_dir }}/tokens"

# This is where you can drop yaml/json files and the kubelet will run those
# pods on startup
kube_manifest_dir: "{{ kube_config_dir }}/manifests"

# This is the group that the cert creation scripts chgrp the
# cert files to. Not really changable...
kube_cert_group: kube-cert
10 changes: 10 additions & 0 deletions contrib/ansible/roles/node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
- include: centos.yml
when: not is_atomic and ansible_distribution == "CentOS"

- name: Make sure manifest directory exists
file: path={{ kube_manifest_dir }} state=directory

- name: Install fluentd pod into each node
get_url:
url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/saltbase/salt/fluentd-es/fluentd-es.yaml
dest="{{ kube_manifest_dir }}"
force=yes
when: cluster_logging

- name: Get the node token values
slurp:
src: "{{ kube_token_dir }}/{{ item }}-{{ inventory_hostname }}.token"
Expand Down
4 changes: 2 additions & 2 deletions contrib/ansible/roles/node/templates/kubelet.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ KUBELET_API_SERVER="--api_servers=https://{{ groups['masters'][0]}}:443"

# Add your own!
{% if dns_setup %}
KUBELET_ARGS="--cluster_dns={{ dns_server }} --cluster_domain={{ dns_domain }} --kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig"
KUBELET_ARGS="--cluster_dns={{ dns_server }} --cluster_domain={{ dns_domain }} --kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig --config={{ kube_manifest_dir }}"
{% else %}
KUBELET_ARGS="--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig"
KUBELET_ARGS="--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig --config={{ kube_manifest_dir }}"
{% endif %}

0 comments on commit 3a78104

Please sign in to comment.