imfreedom/k8s-cluster

15c833b14b3c
Parents 712edf608e3b
Children b9b5512daeab
Add kube-state-metrics to get some more metrics
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/10-kube-state-metrics.yaml Wed Jun 05 19:21:17 2019 -0500
@@ -0,0 +1,131 @@
+# This is a lightly modified version of
+# https://github.com/kubernetes/kube-state-metrics/tree/master/kubernetes to
+# get some "advanced" metrics into the dashboard on digital ocean.
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: kube-state-metrics
+ namespace: kube-system
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ name: kube-state-metrics
+rules:
+ - apiGroups: [""]
+ resources:
+ - configmaps
+ - secrets
+ - nodes
+ - pods
+ - services
+ - resourcequotas
+ - replicationcontrollers
+ - limitranges
+ - persistentvolumeclaims
+ - persistentvolumes
+ - namespaces
+ - endpoints
+ verbs: ["list", "watch"]
+ - apiGroups: ["extensions"]
+ resources:
+ - daemonsets
+ - deployments
+ - replicasets
+ - ingresses
+ verbs: ["list", "watch"]
+ - apiGroups: ["apps"]
+ resources:
+ - daemonsets
+ - deployments
+ - replicasets
+ - statefulsets
+ verbs: ["list", "watch"]
+ - apiGroups: ["batch"]
+ resources:
+ - cronjobs
+ - jobs
+ verbs: ["list", "watch"]
+ - apiGroups: ["autoscaling"]
+ resources:
+ - horizontalpodautoscalers
+ verbs: ["list", "watch"]
+ - apiGroups: ["policy"]
+ resources:
+ - poddisruptionbudgets
+ verbs: ["list", "watch"]
+ - apiGroups: ["certificates.k8s.io"]
+ resources:
+ - certificatesigningrequests
+ verbs: ["list", "watch"]
+---
+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: kube-system
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: kube-state-metrics
+ namespace: kube-system
+ labels:
+ k8s-app: kube-state-metrics
+ annotations:
+ prometheus.io/scrape: 'true'
+spec:
+ ports:
+ - name: http-metrics
+ port: 8080
+ targetPort: http-metrics
+ protocol: TCP
+ - name: telemetry
+ port: 8081
+ targetPort: telemetry
+ protocol: TCP
+ selector:
+ k8s-app: kube-state-metrics
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ k8s-app: kube-state-metrics
+ name: kube-state-metrics
+ namespace: kube-system
+spec:
+ selector:
+ matchLabels:
+ k8s-app: kube-state-metrics
+ replicas: 1
+ template:
+ metadata:
+ labels:
+ k8s-app: kube-state-metrics
+ spec:
+ serviceAccountName: kube-state-metrics
+ containers:
+ - name: kube-state-metrics
+ image: quay.io/coreos/kube-state-metrics:v1.6.0
+ ports:
+ - name: http-metrics
+ containerPort: 8080
+ - name: telemetry
+ containerPort: 8081
+ readinessProbe:
+ httpGet:
+ path: /healthz
+ port: 8080
+ initialDelaySeconds: 5
+ timeoutSeconds: 5
+---
+