Add cluster logging with fluentd and elastic search

pull/6/head
Eric Paris 2015-06-25 22:47:21 -04:00
parent 7d7d5d4c4e
commit 3a78104267
6 changed files with 37 additions and 2 deletions

View File

@ -43,6 +43,9 @@ flannel_prefix: 12
# room for 4096 nodes with 254 pods per node. # room for 4096 nodes with 254 pods per node.
flannel_host_prefix: 24 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 # Turn to false to disable cluster monitoring with heapster and influxdb
cluster_monitoring: true cluster_monitoring: true

View File

@ -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

View File

@ -17,6 +17,9 @@
- include: cluster-monitoring.yml - include: cluster-monitoring.yml
when: cluster_monitoring when: cluster_monitoring
- include: cluster-logging.yml
when: cluster_logging
#- name: Get kube-addons script from Kubernetes #- name: Get kube-addons script from Kubernetes
# get_url: # get_url:
# url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/saltbase/salt/kube-addons/kube-addons.sh # url=https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/cluster/saltbase/salt/kube-addons/kube-addons.sh
@ -42,6 +45,7 @@
with_items: with_items:
- "system:dns" - "system:dns"
- "system:monitoring" - "system:monitoring"
- "system:logging"
register: gentoken register: gentoken
changed_when: "'Added' in gentoken.stdout" changed_when: "'Added' in gentoken.stdout"
notify: notify:

View File

@ -17,6 +17,10 @@ kube_cert_dir: "{{ kube_config_dir }}/certs"
# This is where all of the bearer tokens will be stored # This is where all of the bearer tokens will be stored
kube_token_dir: "{{ kube_config_dir }}/tokens" 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 # This is the group that the cert creation scripts chgrp the
# cert files to. Not really changable... # cert files to. Not really changable...
kube_cert_group: kube-cert kube_cert_group: kube-cert

View File

@ -14,6 +14,16 @@
- include: centos.yml - include: centos.yml
when: not is_atomic and ansible_distribution == "CentOS" 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 - name: Get the node token values
slurp: slurp:
src: "{{ kube_token_dir }}/{{ item }}-{{ inventory_hostname }}.token" src: "{{ kube_token_dir }}/{{ item }}-{{ inventory_hostname }}.token"

View File

@ -15,7 +15,7 @@ KUBELET_API_SERVER="--api_servers=https://{{ groups['masters'][0]}}:443"
# Add your own! # Add your own!
{% if dns_setup %} {% 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 %} {% else %}
KUBELET_ARGS="--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig" KUBELET_ARGS="--kubeconfig={{ kube_config_dir}}/kubelet.kubeconfig --config={{ kube_manifest_dir }}"
{% endif %} {% endif %}