From 453ec3df635c1d19c29fff4f289d458132fc00e7 Mon Sep 17 00:00:00 2001 From: Julian Poyourow Date: Mon, 30 Oct 2023 23:54:32 -0700 Subject: [PATCH] chore: add grafana --- kube/configs/api.yml | 4 +-- kube/configs/grafana.yml | 76 ++++++++++++++++++++++++++++++++++++++++ kube/configs/ingress.yml | 13 ++++++- 3 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 kube/configs/grafana.yml diff --git a/kube/configs/api.yml b/kube/configs/api.yml index 74453dfb7..c220f2a0a 100644 --- a/kube/configs/api.yml +++ b/kube/configs/api.yml @@ -103,8 +103,8 @@ spec: apiVersion: apps/v1 kind: Deployment name: rs-api - minReplicas: 2 - maxReplicas: 4 + minReplicas: 4 + maxReplicas: 6 metrics: - type: Resource resource: diff --git a/kube/configs/grafana.yml b/kube/configs/grafana.yml new file mode 100644 index 000000000..95a2db1ae --- /dev/null +++ b/kube/configs/grafana.yml @@ -0,0 +1,76 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: rs-grafana +spec: + serviceName: rs-grafana + replicas: 1 + selector: + matchLabels: + app: rs-grafana + template: + metadata: + labels: + app: rs-grafana + spec: + initContainers: + - name: rs-grafana-chown + image: alpine + command: ["chown", "-R", "472:472", "/var/lib/grafana"] + resources: + requests: + cpu: 0.1 + memory: 100Mi + limits: + cpu: 0.1 + memory: 500Mi + volumeMounts: + - name: grafana-data + mountPath: /var/lib/grafana + containers: + - name: rs-grafana + image: grafana/grafana-oss + env: + - name: discovery.type + value: single-node + ports: + - containerPort: 3000 + resources: + requests: + cpu: 0.2 + memory: 300Mi + limits: + cpu: 1 + memory: 500Mi + volumeMounts: + - name: grafana-data + mountPath: /var/lib/grafana + volumes: + - name: grafana-data + persistentVolumeClaim: + claimName: grafana-data +--- +apiVersion: v1 +kind: Service +metadata: + name: rs-grafana +spec: + type: ClusterIP + selector: + app: rs-grafana + ports: + - protocol: TCP + port: 3000 + targetPort: 3000 +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-data +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 500Mi + storageClassName: do-block-storage diff --git a/kube/configs/ingress.yml b/kube/configs/ingress.yml index 1f406f523..b5fac9310 100644 --- a/kube/configs/ingress.yml +++ b/kube/configs/ingress.yml @@ -12,7 +12,7 @@ metadata: nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/from-to-www-redirect: "true" nginx.ingress.kubernetes.io/limit-rps: "5" - nginx.ingress.kubernetes.io/limit-burst-multiplier: "4" + nginx.ingress.kubernetes.io/limit-burst-multiplier: "6" nginx.ingress.kubernetes.io/server-snippet: | gzip on; gzip_vary on; @@ -80,6 +80,16 @@ spec: name: rs-pushpin port: number: 7999 + - host: grafana.recipesage.com + http: + paths: + - path: /()(.*) + pathType: Prefix + backend: + service: + name: rs-grafana + port: + number: 3000 tls: - hosts: - recipesage.com @@ -89,6 +99,7 @@ spec: - api.recipesage.com - api.beta.recipesage.com - grip.recipesage.com + - grafana.recipesage.com secretName: rs-tls --- apiVersion: cert-manager.io/v1