From ec1dbb853c3ace28a7e01bc5b6e3e396f418c43a Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sun, 22 Oct 2017 21:19:22 -0700 Subject: [PATCH] addons: Include kube-state-metrics exporter manifests --- .../cluster-role-binding.yaml | 12 ++++ .../kube-state-metrics/cluster-role.yaml | 31 +++++++++ .../kube-state-metrics/deployment.yaml | 67 +++++++++++++++++++ .../resizer-role-binding.yaml | 13 ++++ .../kube-state-metrics/resizer-role.yaml | 15 +++++ .../kube-state-metrics/service-account.yaml | 5 ++ .../exporters/kube-state-metrics/service.yaml | 17 +++++ 7 files changed, 160 insertions(+) create mode 100644 addons/prometheus/exporters/kube-state-metrics/cluster-role-binding.yaml create mode 100644 addons/prometheus/exporters/kube-state-metrics/cluster-role.yaml create mode 100644 addons/prometheus/exporters/kube-state-metrics/deployment.yaml create mode 100644 addons/prometheus/exporters/kube-state-metrics/resizer-role-binding.yaml create mode 100644 addons/prometheus/exporters/kube-state-metrics/resizer-role.yaml create mode 100644 addons/prometheus/exporters/kube-state-metrics/service-account.yaml create mode 100644 addons/prometheus/exporters/kube-state-metrics/service.yaml diff --git a/addons/prometheus/exporters/kube-state-metrics/cluster-role-binding.yaml b/addons/prometheus/exporters/kube-state-metrics/cluster-role-binding.yaml new file mode 100644 index 00000000..9a8f3111 --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/cluster-role-binding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: kube-state-metrics +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: kube-state-metrics +subjects: +- kind: ServiceAccount + name: kube-state-metrics + namespace: monitoring diff --git a/addons/prometheus/exporters/kube-state-metrics/cluster-role.yaml b/addons/prometheus/exporters/kube-state-metrics/cluster-role.yaml new file mode 100644 index 00000000..0ef877fd --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/cluster-role.yaml @@ -0,0 +1,31 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kube-state-metrics +rules: +- apiGroups: [""] + resources: + - nodes + - pods + - services + - resourcequotas + - replicationcontrollers + - limitranges + - persistentvolumeclaims + - namespaces + verbs: ["list", "watch"] +- apiGroups: ["extensions"] + resources: + - daemonsets + - deployments + - replicasets + verbs: ["list", "watch"] +- apiGroups: ["apps"] + resources: + - statefulsets + verbs: ["list", "watch"] +- apiGroups: ["batch"] + resources: + - cronjobs + - jobs + verbs: ["list", "watch"] diff --git a/addons/prometheus/exporters/kube-state-metrics/deployment.yaml b/addons/prometheus/exporters/kube-state-metrics/deployment.yaml new file mode 100644 index 00000000..b814411a --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/deployment.yaml @@ -0,0 +1,67 @@ +apiVersion: apps/v1beta2 +kind: Deployment +metadata: + name: kube-state-metrics + namespace: monitoring +spec: + replicas: 1 + strategy: + rollingUpdate: + maxUnavilable: 1 + selector: + matchLabels: + name: kube-state-metrics + phase: prod + template: + metadata: + labels: + name: kube-state-metrics + phase: prod + spec: + serviceAccountName: kube-state-metrics + containers: + - name: kube-state-metrics + image: quay.io/coreos/kube-state-metrics:v1.1.0 + ports: + - name: metrics + containerPort: 8080 + readinessProbe: + httpGet: + path: /healthz + port: 8080 + initialDelaySeconds: 5 + timeoutSeconds: 5 + resources: + requests: + memory: 100Mi + cpu: 100m + limits: + memory: 200Mi + cpu: 200m + - name: addon-resizer + image: gcr.io/google_containers/addon-resizer:1.0 + resources: + limits: + cpu: 100m + memory: 30Mi + requests: + cpu: 100m + memory: 30Mi + env: + - name: MY_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: MY_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + command: + - /pod_nanny + - --container=kube-state-metrics + - --cpu=100m + - --extra-cpu=1m + - --memory=100Mi + - --extra-memory=2Mi + - --threshold=5 + - --deployment=kube-state-metrics diff --git a/addons/prometheus/exporters/kube-state-metrics/resizer-role-binding.yaml b/addons/prometheus/exporters/kube-state-metrics/resizer-role-binding.yaml new file mode 100644 index 00000000..656e3db6 --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/resizer-role-binding.yaml @@ -0,0 +1,13 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: kube-state-metrics + namespace: monitoring +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: kube-state-metrics-resizer +subjects: +- kind: ServiceAccount + name: kube-state-metrics + namespace: monitoring diff --git a/addons/prometheus/exporters/kube-state-metrics/resizer-role.yaml b/addons/prometheus/exporters/kube-state-metrics/resizer-role.yaml new file mode 100644 index 00000000..49746064 --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/resizer-role.yaml @@ -0,0 +1,15 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: kube-state-metrics-resizer + namespace: monitoring +rules: +- apiGroups: [""] + resources: + - pods + verbs: ["get"] +- apiGroups: ["extensions"] + resources: + - deployments + resourceNames: ["kube-state-metrics"] + verbs: ["get", "update"] diff --git a/addons/prometheus/exporters/kube-state-metrics/service-account.yaml b/addons/prometheus/exporters/kube-state-metrics/service-account.yaml new file mode 100644 index 00000000..fff1028b --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/service-account.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: kube-state-metrics + namespace: monitoring diff --git a/addons/prometheus/exporters/kube-state-metrics/service.yaml b/addons/prometheus/exporters/kube-state-metrics/service.yaml new file mode 100644 index 00000000..2980440b --- /dev/null +++ b/addons/prometheus/exporters/kube-state-metrics/service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: kube-state-metrics + namespace: monitoring + annotations: + prometheus.io/scrape: 'true' +spec: + type: ClusterIP + selector: + name: kube-state-metrics + phase: prod + ports: + - name: metrics + protocol: TCP + port: 80 + targetPort: 8080