1
0
Fork 0

cleanup monitoring

This commit is contained in:
Massaki Archambault 2020-05-31 18:05:21 -04:00
parent 68e250b918
commit 318e766cab
14 changed files with 45 additions and 84 deletions

View File

@ -2,6 +2,8 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: grafana name: grafana
labels:
app: grafana
spec: spec:
selector: selector:
matchLabels: matchLabels:
@ -22,7 +24,7 @@ spec:
- name: GF_DATABASE_TYPE - name: GF_DATABASE_TYPE
value: mysql value: mysql
- name: GF_DATABASE_HOST - name: GF_DATABASE_HOST
value: mariadb.monitoring.svc:3306 value: mariadb.grafana.svc:3306
- name: GF_DATABASE_NAME - name: GF_DATABASE_NAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
@ -53,6 +55,9 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: grafana name: grafana
labels:
app: grafana
monitor: main
spec: spec:
selector: selector:
app: grafana app: grafana
@ -66,6 +71,8 @@ apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: grafana name: grafana
labels:
app: grafana
annotations: annotations:
nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/rewrite-target: /
cert-manager.io/cluster-issuer: letsencrypt cert-manager.io/cluster-issuer: letsencrypt

View File

@ -1,9 +1,9 @@
bases: bases:
- ../../mariadb - ../mariadb
resources: resources:
- namespace.yaml
- grafana-deployment.yaml - grafana-deployment.yaml
- grafana-servicemonitor.yaml
configMapGenerator: configMapGenerator:
- name: grafana-datasources - name: grafana-datasources

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: grafana

View File

@ -1,14 +0,0 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: grafana
labels:
monitor: main
spec:
selector:
matchLabels:
managed-by: kustomize
app: grafana
endpoints:
- port: http
path: /metrics

View File

@ -2,7 +2,6 @@ bases:
- kube-state-metrics - kube-state-metrics
- node-exporter - node-exporter
- prometheus - prometheus
- grafana
- prometheus-operator - prometheus-operator
resources: resources:

View File

@ -1,6 +1,2 @@
resources: resources:
- node-exporter-daemonset.yaml - node-exporter-daemonset.yaml
- node-exporter-servicemonitor.yaml
commonLabels:
app: node-exporter

View File

@ -3,6 +3,8 @@ kind: DaemonSet
metadata: metadata:
name: node-exporter name: node-exporter
namespace: kube-monitoring namespace: kube-monitoring
labels:
app: node-exporter
spec: spec:
selector: selector:
matchLabels: matchLabels:
@ -53,6 +55,9 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: nodes-exporter name: nodes-exporter
labels:
app: node-exporter
monitor: main
spec: spec:
type: ClusterIP type: ClusterIP
ports: ports:

View File

@ -1,14 +0,0 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: node-exporter
labels:
monitor: main
spec:
selector:
matchLabels:
managed-by: kustomize
app: node-exporter
endpoints:
- port: http-metrics
path: /metrics

View File

@ -3,15 +3,5 @@ kind: RemoteResources
metadata: metadata:
name: prometheus-operator name: prometheus-operator
resources: resources:
- url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/rbac/prometheus-operator/prometheus-operator-cluster-role-binding.yaml - url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/bundle.yaml
sha256: 22c1f67d0417fc743660d3e55b2d2c19b767f62dfb5326bda97b5bbfba875b6f sha256: 557721b7638055102c150f68a924b6c4d0b36439a0fb87cb0cddbaf89e1c2c57
- url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/rbac/prometheus-operator/prometheus-operator-cluster-role.yaml
sha256: 6475a9fe2a044a3653d9047c9e57598afd6deefb72bbe6521e3a101f2148cada
- url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/rbac/prometheus-operator/prometheus-operator-deployment.yaml
sha256: ceb21dc7274285143301ca9ab7ef4dec07c3d83a8b15113b5ccdbd73ecaad49a
- url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/rbac/prometheus-operator/prometheus-operator-service-account.yaml
sha256: f9cb00698e38c3db99a3b750b4a27ba2bb07e6574ceaa13eb5aa976bb72ca5f6
- url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/rbac/prometheus-operator/prometheus-operator-service-monitor.yaml
sha256: 26ceeabca8dd0c6069e1ad918e8b02df67b3667864c4cf985c48a3b07692c6ae
- url: https://raw.githubusercontent.com/coreos/prometheus-operator/master/example/rbac/prometheus-operator/prometheus-operator-service.yaml
sha256: f600f2aa9b4b2090d1ab52018d7cf74853e40edfd71532db4f2e9323cf6f3505

View File

@ -1,7 +1,7 @@
resources: resources:
- prometheus-crd.yaml - prometheus.yaml
- prometheus-rbac.yaml - prometheus-rbac.yaml
- prometheus-servicemonitor.yaml - servicemonitors.yaml
commonLabels: commonLabels:
app: prometheus app: prometheus

View File

@ -3,31 +3,15 @@ kind: Prometheus
metadata: metadata:
name: main name: main
spec: spec:
podMetadata:
labels:
managed-by: kustomize
serviceAccountName: prometheus serviceAccountName: prometheus
serviceMonitorSelector: serviceMonitorSelector:
matchLabels: matchLabels:
monitor: main monitor: main
resources: resources:
requests: requests:
memory: 400Mi memory: 300Mi
--- limits:
apiVersion: v1 memory: 500Mi
kind: Service
metadata:
name: prometheus-main
labels:
prometheus: main
spec:
selector:
prometheus: main
ports:
- name: web
protocol: TCP
port: 9090
targetPort: web
--- ---
apiVersion: networking.k8s.io/v1beta1 apiVersion: networking.k8s.io/v1beta1
kind: Ingress kind: Ingress
@ -47,5 +31,5 @@ spec:
paths: paths:
- path: / - path: /
backend: backend:
serviceName: prometheus-main serviceName: prometheus-operated
servicePort: web servicePort: web

View File

@ -3,20 +3,33 @@ kind: ServiceMonitor
metadata: metadata:
name: prometheus name: prometheus
labels: labels:
app: prometheus
monitor: main monitor: main
spec: spec:
selector: selector:
matchLabels: matchLabels:
managed-by: kustomize operated-prometheus: "true"
app: prometheus
prometheus: main
endpoints: endpoints:
- port: web - port: web
path: /metrics path: /metrics
--- ---
apiVersion: monitoring.coreos.com/v1 apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor kind: ServiceMonitor
metadata:
name: servicemonitor-http
labels:
monitor: main
spec:
namespaceSelector:
any: true
selector:
matchLabels:
monitor: main
endpoints:
- port: http
path: /metrics
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata: metadata:
name: kubelet name: kubelet
labels: labels:

View File

@ -2,6 +2,7 @@ bases:
- ../../base/kubernetes-dashboard - ../../base/kubernetes-dashboard
- ../../base/gitea - ../../base/gitea
- ../../base/nextcloud - ../../base/nextcloud
- ../../base/grafana
- ../../base/monitoring - ../../base/monitoring
resources: resources:
@ -35,16 +36,6 @@ patchesJson6902:
- op: replace - op: replace
path: /spec/rules/0/host path: /spec/rules/0/host
value: kubernetes-dashboard.staging.badjware.dev value: kubernetes-dashboard.staging.badjware.dev
- target:
<<: *ingress_target
name: prometheus
patch: |-
- op: replace
path: /spec/tls/0/hosts/0
value: prometheus.staging.badjware.dev
- op: replace
path: /spec/rules/0/host
value: prometheus.staging.badjware.dev
- target: - target:
<<: *ingress_target <<: *ingress_target
name: grafana name: grafana