summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhu xinhui <xinhui_hu@foxmail.com>2018-04-06 19:23:45 +0800
committerhu xinhui <xinhui_hu@foxmail.com>2018-04-06 19:54:55 +0800
commit5e58f6fa90f1a32b50fb5b358e0d622cc019fd86 (patch)
treebf741b7f636d2f53be2bfee1f200b1575546be98
parent18cf3eec4990e2e747cadc8b9c177e5b1d0c67f4 (diff)
Add the Heapster + InfluxDB + Grafana Monitoring scheme
JIRA: 1. The kubernetes cluster deployed by the kubespary does not support the monitoring scheme. 2. This patch is to complete the monitoring scheme for k8s Change-Id: I89faf75a8b78cd70dfc9d8433ea582aecb2f8001 Signed-off-by: hu xinhui <xinhui_hu@foxmail.com>
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/post-k8s/defaults/main.yml11
-rw-r--r--deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml39
2 files changed, 50 insertions, 0 deletions
diff --git a/deploy/adapters/ansible/kubernetes/roles/post-k8s/defaults/main.yml b/deploy/adapters/ansible/kubernetes/roles/post-k8s/defaults/main.yml
new file mode 100644
index 00000000..aa9fd8a0
--- /dev/null
+++ b/deploy/adapters/ansible/kubernetes/roles/post-k8s/defaults/main.yml
@@ -0,0 +1,11 @@
+---
+
+local_release_dir: "/tmp/releases"
+heapster_enable: true
+retry_stagger: 5
+heapster:
+ enabled: true
+ owner: "root"
+ mode: "0755"
+ version: "1.5.2"
+heapster_download_url: https://github.com/kubernetes/heapster/archive/v{{ heapster.version }}.tar.gz
diff --git a/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml b/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml
index 3feca3e5..1c691b8e 100644
--- a/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml
+++ b/deploy/adapters/ansible/kubernetes/roles/post-k8s/tasks/main.yml
@@ -14,3 +14,42 @@
dest: /opt/admin.conf
flat: "yes"
when: inventory_hostname == groups['kube_master'][0]
+
+- name: Create heapster dest directory
+ file:
+ path: "{{local_release_dir}}/heapster"
+ state: directory
+ recurse: "yes"
+ when:
+ - heapster.enabled
+ - inventory_hostname == groups['kube_master'][0]
+
+- name: get the package of heapster
+ get_url:
+ url: "{{heapster_download_url}}"
+ dest: "{{local_release_dir}}/heapster"
+ owner: "{{ heapster.owner|default(omit) }}"
+ mode: "{{ heapster.mode|default(omit) }}"
+ register: get_url_result
+ until: "'OK' in get_url_result.msg or 'file already exists' in get_url_result.msg"
+ retries: 4
+ delay: "{{ retry_stagger | random + 3 }}"
+ when:
+ - heapster.enabled
+ - inventory_hostname == groups['kube_master'][0]
+
+- name: untar the file of heapster
+ shell: |
+ cd "{{ local_release_dir }}/heapster";
+ tar zxvf "heapster-{{ heapster.version }}.tar.gz"
+ when:
+ - heapster.enabled
+ - inventory_hostname == groups['kube_master'][0]
+
+- name: install the heapster
+ shell: |
+ cd "{{ local_release_dir }}/heapster/heapster-{{ heapster.version }}/deploy/";
+ ./kube.sh start
+ when:
+ - heapster.enabled
+ - inventory_hostname == groups['kube_master'][0]