Browse Source
Merge pull request #2547 from bobahspb/master
prometheus operator, metrics for k8s cluster
pull/2573/head
Andreas Krüger
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
56 additions and
1 deletions
-
inventory/sample/group_vars/k8s-cluster.yml
-
roles/kubernetes-apps/meta/main.yml
-
roles/kubernetes-apps/metrics/defaults/main.yml
-
roles/kubernetes-apps/metrics/tasks/main.yml
-
tests/files/gce_centos7-flannel-addons.yml
|
|
@ -162,9 +162,15 @@ dashboard_enabled: true |
|
|
|
# Monitoring apps for k8s |
|
|
|
efk_enabled: false |
|
|
|
|
|
|
|
# Helm deployment |
|
|
|
# Helm deployment. Needs for Prometheus Operator, k8s metrics. |
|
|
|
helm_enabled: false |
|
|
|
|
|
|
|
# Prometheus Operator. Needs for k8s metrics. Installed Helm is required. |
|
|
|
prometheus_operator_enabled: false |
|
|
|
|
|
|
|
# K8s cluster metrics. Installed Helm and Prometheus Operator are required. |
|
|
|
k8s_metrics_enabled: false |
|
|
|
|
|
|
|
# Istio deployment |
|
|
|
istio_enabled: false |
|
|
|
|
|
|
|
|
|
@ -27,6 +27,12 @@ dependencies: |
|
|
|
- apps |
|
|
|
- registry |
|
|
|
|
|
|
|
- role: kubernetes-apps/metrics |
|
|
|
when: prometheus_operator_enabled |
|
|
|
tags: |
|
|
|
- apps |
|
|
|
- metrics |
|
|
|
|
|
|
|
# istio role should be last because it takes a long time to initialize and |
|
|
|
# will cause timeouts trying to start other addons. |
|
|
|
- role: kubernetes-apps/istio |
|
|
|
|
|
@ -0,0 +1,9 @@ |
|
|
|
--- |
|
|
|
# Prometheus Operator. Needs for k8s metrics. Installed Helm is required. |
|
|
|
prometheus_operator_enabled: false |
|
|
|
|
|
|
|
# K8s cluster metrics. Installed Helm and Prometheus Operators are required. |
|
|
|
k8s_metrics_enabled: false |
|
|
|
|
|
|
|
# Separate namespace for monitoring/metrics |
|
|
|
monitoring_namespace: "monitoring" |
|
|
@ -0,0 +1,32 @@ |
|
|
|
--- |
|
|
|
- name: Metrics | Make sure Helm is installed |
|
|
|
command: "{{ bin_dir }}/helm version" |
|
|
|
register: helm_ready_result |
|
|
|
until: helm_ready_result|succeeded |
|
|
|
retries: 4 |
|
|
|
delay: 5 |
|
|
|
when: |
|
|
|
- prometheus_operator_enabled |
|
|
|
- inventory_hostname == groups['kube-master'][0] |
|
|
|
|
|
|
|
- name: Metrics | Add coreos repo |
|
|
|
command: "{{ bin_dir }}/helm repo add coreos https://s3-eu-west-1.amazonaws.com/coreos-charts/stable/" |
|
|
|
when: |
|
|
|
- prometheus_operator_enabled |
|
|
|
- inventory_hostname == groups['kube-master'][0] |
|
|
|
run_once: true |
|
|
|
|
|
|
|
- name: Metrics | Install Prometheus Operator |
|
|
|
command: "{{ bin_dir }}/helm upgrade --install prometheus-operator coreos/prometheus-operator --namespace {{ monitoring_namespace }}" |
|
|
|
when: |
|
|
|
- prometheus_operator_enabled |
|
|
|
- inventory_hostname == groups['kube-master'][0] |
|
|
|
run_once: true |
|
|
|
|
|
|
|
- name: Metrics | Install K8s cluster metrics |
|
|
|
command: "{{ bin_dir }}/helm upgrade --install kube-prometheus coreos/kube-prometheus --namespace {{ monitoring_namespace }}" |
|
|
|
when: |
|
|
|
- prometheus_operator_enabled |
|
|
|
- k8s_metrics_enabled |
|
|
|
- inventory_hostname == groups['kube-master'][0] |
|
|
|
run_once: true |
|
|
@ -16,5 +16,7 @@ deploy_netchecker: true |
|
|
|
kubedns_min_replicas: 1 |
|
|
|
cloud_provider: gce |
|
|
|
kube_encrypt_secret_data: true |
|
|
|
prometheus_operator_enabled: true |
|
|
|
k8s_metrics_enabled: true |
|
|
|
ingress_nginx_enabled: true |
|
|
|
cert_manager_enabled: true |