summaryrefslogtreecommitdiff
path: root/roles/kubernetes/addons/metrics-server
diff options
context:
space:
mode:
Diffstat (limited to 'roles/kubernetes/addons/metrics-server')
-rw-r--r--roles/kubernetes/addons/metrics-server/defaults/main.yml2
-rw-r--r--roles/kubernetes/addons/metrics-server/tasks/main.yml38
2 files changed, 23 insertions, 17 deletions
diff --git a/roles/kubernetes/addons/metrics-server/defaults/main.yml b/roles/kubernetes/addons/metrics-server/defaults/main.yml
new file mode 100644
index 00000000..2e7e78e2
--- /dev/null
+++ b/roles/kubernetes/addons/metrics-server/defaults/main.yml
@@ -0,0 +1,2 @@
+---
+# kubernetes_metrics_server_version: 0.6.1
diff --git a/roles/kubernetes/addons/metrics-server/tasks/main.yml b/roles/kubernetes/addons/metrics-server/tasks/main.yml
index 87c57346..79bf1cf1 100644
--- a/roles/kubernetes/addons/metrics-server/tasks/main.yml
+++ b/roles/kubernetes/addons/metrics-server/tasks/main.yml
@@ -1,21 +1,25 @@
---
-- name: create base directory for metrics-server addon
- file:
- path: /etc/kubernetes/addons/metrics-server
- state: directory
+- name: deploy metrics-server addon
+ run_once: true
+ delegate_to: "{{ groups['_kubernetes_primary_controlplane_node_'] | first }}"
+ block:
+ - name: create base directory for metrics-server addon
+ file:
+ path: /etc/kubernetes/addons/metrics-server
+ state: directory
-- name: copy config for metrics-server
- template:
- src: "components.{{ kubernetes_metrics_server_version }}.yml.j2"
- dest: /etc/kubernetes/addons/metrics-server/config.yml
+ - name: copy config for metrics-server
+ template:
+ src: "components.{{ kubernetes_metrics_server_version }}.yml.j2"
+ dest: /etc/kubernetes/addons/metrics-server/config.yml
-- name: check if metrics-server is already installed
- check_mode: no
- command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/addons/metrics-server/config.yml
- failed_when: false
- changed_when: false
- register: kube_metrics_server_diff_result
+ - name: check if metrics-server is already installed
+ check_mode: no
+ command: kubectl --kubeconfig /etc/kubernetes/admin.conf diff -f /etc/kubernetes/addons/metrics-server/config.yml
+ failed_when: false
+ changed_when: false
+ register: kube_metrics_server_diff_result
-- name: install metrics-server onto the cluster
- when: kube_metrics_server_diff_result.rc != 0
- command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/addons/metrics-server/config.yml
+ - name: install metrics-server onto the cluster
+ when: kube_metrics_server_diff_result.rc != 0
+ command: kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/addons/metrics-server/config.yml