From 08ad6aefb49242fda4945cba7420397cc34b8627 Mon Sep 17 00:00:00 2001 From: unchaptered Date: Fri, 8 Nov 2024 15:38:11 +0900 Subject: [PATCH] feat : uptime-kuma helm chart --- helm/uptime-kuma/README.md | 69 ++++++++++++ helm/uptime-kuma/templates/deploy.yaml | 26 +---- helm/uptime-kuma/templates/ingress.yaml | 2 +- helm/uptime-kuma/templates/pv.yaml | 5 +- helm/uptime-kuma/templates/pvc.yaml | 3 +- helm/uptime-kuma/templates/svc.yaml | 7 +- helm/uptime-kuma/values-test.yaml | 51 +++------ helm/uptime-kuma/values.yaml | 142 +++++++++++------------- 8 files changed, 163 insertions(+), 142 deletions(-) create mode 100644 helm/uptime-kuma/README.md diff --git a/helm/uptime-kuma/README.md b/helm/uptime-kuma/README.md new file mode 100644 index 000000000..0b671528c --- /dev/null +++ b/helm/uptime-kuma/README.md @@ -0,0 +1,69 @@ +# Uptime Kuma + +Uptime Kuma is an easy-to-use self-hosted monitoring tool. + +Homepage : https://uptime.kuma.pet/ + +### Source Code + +- https://github.com/louislam/uptime-kuma + +### TL:DR + +```shell +helm install uptime-kuma uptime-kuma -n uptime-kuma \ + --values values-test.yaml \ + --set persistVolume.csi.handle= \ + --set ingress.host= \ + --set ingress.metadata.annotations.alb\.ingress\.kubernetes\.io/vpc-id= +``` + +> In [Installation & Configuration](https://github.com/louislam/uptime-kuma/wiki/%F0%9F%94%A7-How-to-Install), uptime-kuma officially recommend volume mapping to `/app/data`.
+> So I used the PersistVolume(e.g. efs), PersistVolumeCliam to maintain persistance data.
+ +### Requirements + +I used these helm chart with Amazon EKS 1.30. + +> HOWEVER, I don't use any special features that are only available in certain versions,
+> so I guess it would be campatiable Amazon EKS 1.30, and more. + + +| Requirements | Name | Version | Ref | +| ---------------------------------------------------- | ---------------------------- | ------- | --------------------------------------------------------------- | +| https://aws.github.io/eks-charts | aws-load-balancer-controller | 1.8.1 | https://github.com/kubernetes-sigs/aws-load-balancer-controller | +| https://kubernetes-sigs.github.io/aws-efs-csi-driver | aws-efs-csi-driver | 3.0.4 | https://github.com/kubernetes-sigs/aws-efs-csi-driver | + +### Values + +| Key | Type | Default | +| ------------------------------------------- | ------ | ------------------------ | +| nameOverride | string | `nil` | +| namespaceOverride | string | `nil` | +| isEnableService | bool | `false` | +| isEnableIngress | bool | `false` | +| isEnablePersistVolume | bool | `false` | +| deployment.image | string | `louislam/uptime-kuma:1` | +| deployment.port | int | `3001` | +| deployment.spec.replicas | int | `1` | +| deployment.request.cpu | string | `256Mi` | +| deployment.request.memory | string | `150m` | +| service.metadata.labels | object | `{}` | +| service.metadata.annotations | object | `{}` | +| service.spec.type | string | `NodePort` | +| service.spec.sessionAffinity | string | `nil` | +| service.spec.selectors | object | `{}` | +| service.spec.externalTrafficPolicy | string | `nil` | +| service.spec.externalIPs | list | `[]` | +| ingress.host | string | `example.com` | +| ingress.ingressClassName | string | `alb` | +| ingress.metadata.labels | object | `{}` | +| ingress.metadata.annotations | object | `{}` | +| ingress.spec.selector | object | `{}` | +| persistVolume.size | string | `1Gi` | +| persistVolume.volumemode | string | `FileSystem` | +| persistVolume.accessmode | string | `ReadWriteMany` | +| persistVolume.persistentVolumeReclaimPolicy | string | `Retain` | +| persistVolume.storageClass | string | `efs-sc` | +| persistVolume.csi.driver | string | `efs.csi.aws.com` | +| persistVolume.csi.handle | string | `nil` | diff --git a/helm/uptime-kuma/templates/deploy.yaml b/helm/uptime-kuma/templates/deploy.yaml index 49ddab380..7d9002afe 100644 --- a/helm/uptime-kuma/templates/deploy.yaml +++ b/helm/uptime-kuma/templates/deploy.yaml @@ -1,9 +1,11 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: dep-{{ default .Chart.Name .Values.nameOverride }} + name: {{ default .Chart.Name .Values.nameOverride }} namespace: {{ default .Chart.Name .Values.namespaceOverride }} - + labels: + app: {{ default .Chart.Name .Values.nameOverride }} + spec: replicas: {{ .Values.deployment.spec.replicas }} strategy: @@ -27,27 +29,9 @@ spec: ports: - containerPort: {{ default "3001" .Values.deployment.port }} volumeMounts: - - name: app_data + - name: pvc-{{ default .Chart.Name .Values.nameOverride }} mountPath: /app/data - readinessProbe: # Pod Container, 연결성 테스트 (트래픽 라우트 조건) - tcpSocket: - port: {{ default "3001" .Values.deployment.port }} - initialDelaySeconds: {{ default 60 .Values.deployment.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ default 60 .Values.deployment.readinessProbe.periodSeconds }} - livenessProbe: # Pod Container, 연결성 테스트 (재시작 조건) - httpGet: - path: {{ default "/" .Values.deployment.livenessProbe.path }} - port: {{ default "3001" .Values.deployment.port }} - initialDelaySeconds: {{ default 60 .Values.deployment.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ default 60 .Values.deployment.livenessProbe.periodSeconds }} - startupProbe: # Pod 실행 전, 연결성 테스트 - httpGet: - path: {{ default "/" .Values.deployment.startupProbe.path }} - port: {{ default "3001" .Values.deployment.port }} - initialDelaySeconds: {{ default 60 .Values.deployment.startupProbe.initialDelaySeconds }} - periodSeconds: {{ default 60 .Values.deployment.startupProbe.periodSeconds }} - resources: requests: memory: "{{ default "256Mi" .Values.deployment.request.memory }}" diff --git a/helm/uptime-kuma/templates/ingress.yaml b/helm/uptime-kuma/templates/ingress.yaml index 9df5054e1..d1ee120b3 100644 --- a/helm/uptime-kuma/templates/ingress.yaml +++ b/helm/uptime-kuma/templates/ingress.yaml @@ -37,7 +37,7 @@ spec: pathType: Prefix backend: service: - name: carrieverse-abc-cms-api-dev + name: svc-{{ default .Chart.Name .Values.nameOverride }} port: number: 80 serviceName: svc-{{ default .Chart.Name .Values.nameOverride }} diff --git a/helm/uptime-kuma/templates/pv.yaml b/helm/uptime-kuma/templates/pv.yaml index cefc19dee..637ce9b3d 100644 --- a/helm/uptime-kuma/templates/pv.yaml +++ b/helm/uptime-kuma/templates/pv.yaml @@ -8,8 +8,9 @@ spec: capacity: storage: {{ .Values.persistVolume.size }} volumeMode: {{ .Values.persistVolume.volumemode }} - accessModes: {{ .Values.persistVolume.accessmode }} - persistentVolumeReclaimPolicy: {{ .Values.persistVolume.persistentvolumereclaimpolicy }} + accessModes: + - {{ .Values.persistVolume.accessmode }} + persistentVolumeReclaimPolicy: {{ .Values.persistVolume.persistentVolumeReclaimPolicy }} storageClassName: {{ .Values.persistVolume.storageClass }} csi: driver: {{ .Values.persistVolume.csi.driver }} diff --git a/helm/uptime-kuma/templates/pvc.yaml b/helm/uptime-kuma/templates/pvc.yaml index c9f268873..3682c5395 100644 --- a/helm/uptime-kuma/templates/pvc.yaml +++ b/helm/uptime-kuma/templates/pvc.yaml @@ -7,7 +7,8 @@ metadata: annotations: volume.beta.kubernetes.io/storage-class: {{ .Values.persistVolume.storageClass }} spec: - accessModes: {{ .Values.persistVolume.accessmode }} + accessModes: + - {{ .Values.persistVolume.accessmode }} storageClassName: {{ .Values.persistVolume.storageClass }} resources: requests: diff --git a/helm/uptime-kuma/templates/svc.yaml b/helm/uptime-kuma/templates/svc.yaml index c1b1919d9..d38292882 100644 --- a/helm/uptime-kuma/templates/svc.yaml +++ b/helm/uptime-kuma/templates/svc.yaml @@ -5,8 +5,9 @@ metadata: name: svc-{{ default .Chart.Name .Values.nameOverride }} namespace: {{ default .Chart.Name .Values.namespaceOverride }} - {{- with .Values.service.metadata.labels}} labels: + app: {{ default .Chart.Name .Values.nameOverride }} + {{- with .Values.service.metadata.labels}} {{- range $key, $value := . }} {{ $key }}: {{ $value | quote }} {{- end}} @@ -20,8 +21,8 @@ metadata: {{- end }} spec: - annotations: - app: dep-{{ default .Chart.Name .Values.nameOverride }} + selector: + app: {{ default .Chart.Name .Values.nameOverride }} {{- with .Values.service.spec.selector }} {{- range $key, $value := .}} {{ $key }}: {{ $value | quote }} diff --git a/helm/uptime-kuma/values-test.yaml b/helm/uptime-kuma/values-test.yaml index 4b9dee1e7..c1427649d 100644 --- a/helm/uptime-kuma/values-test.yaml +++ b/helm/uptime-kuma/values-test.yaml @@ -1,21 +1,10 @@ nameOverride: namespaceOverride: -# serviceAccountName: ~ -# serviceAccount: -# create: false -# annotations: {} - -isEnableConfigmap: false -isEnableIngress: true isEnableService: true +isEnableIngress: true isEnablePersistVolume: true -configmap: - dataMap: - SAMPLE_KEY_1: SAMPLE_VALUE_1 - SAMPLE_KEY_2: 1 - deployment: image: louislam/uptime-kuma:1 port: 3001 @@ -27,18 +16,6 @@ deployment: cpu: ~ memory: ~ - readinessProbe: - initialDelaySeconds: ~ - periodSeconds: ~ - livenessProbe: - path: / - initialDelaySeconds: ~ - periodSeconds: ~ - startupProbe: - path: / - initialDelaySeconds: ~ - periodSeconds: ~ - service: metadata: labels: ~ @@ -51,22 +28,22 @@ service: externalTrafficPolicy: ~ externalIPs: ~ -# , , +# , lb_name, ingress: - host: example.com + host: host_name ingressClassName: alb metadata: labels: ~ annotations: - alb.ingress.kubernetes.io/vpc-id: + alb.ingress.kubernetes.io/vpc-id: "VPC_ID" alb.ingress.kubernetes.io/scheme: internet-facing alb.ingress.kubernetes.io/target-type: ip alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]' - alb.ingress.kubernetes.io/load-balancer-name: - alb.ingress.kubernetes.io/tags: Name= + alb.ingress.kubernetes.io/load-balancer-name: lb_name + alb.ingress.kubernetes.io/tags: Name=lb_name - alb.ingress.kubernetes.io/certificate-arn: + # alb.ingress.kubernetes.io/certificate-arn: alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-2016-08 kubernetes.io/ingress.class: alb @@ -99,7 +76,7 @@ ingress: "forwardConfig": { "targetGroups": [ { - "serviceName": "", + "serviceName": "lb_name", "servicePort": 80, "weight": 100 } @@ -110,13 +87,13 @@ ingress: } } - alb.ingress.kubernetes.io/actions.: | + alb.ingress.kubernetes.io/actions.lb_name: | { "type": "forward", "forwardConfig": { "targetGroups": [ { - "serviceName": "", + "serviceName": "lb_name", "servicePort": 80, "weight": 100 } @@ -132,11 +109,11 @@ ingress: persistVolume: - size: 1Gi - volumemode: FileSystem + size: 5Gi + volumemode: Filesystem accessmode: ReadWriteMany - persistentvolumereclaimpolicy: Retain + persistentVolumeReclaimPolicy: Retain storageClass: efs-sc csi: driver: efs.csi.aws.com - handle: ~ \ No newline at end of file + handle: fs_name \ No newline at end of file diff --git a/helm/uptime-kuma/values.yaml b/helm/uptime-kuma/values.yaml index 216f188c5..211339c79 100644 --- a/helm/uptime-kuma/values.yaml +++ b/helm/uptime-kuma/values.yaml @@ -1,8 +1,8 @@ nameOverride: namespaceOverride: -isEnableIngress: false isEnableService: false +isEnableIngress: false isEnablePersistVolume: false deployment: @@ -16,18 +16,6 @@ deployment: cpu: ~ memory: ~ - readinessProbe: - initialDelaySeconds: ~ - periodSeconds: ~ - livenessProbe: - path: / - initialDelaySeconds: ~ - periodSeconds: ~ - startupProbe: - path: / - initialDelaySeconds: ~ - periodSeconds: ~ - service: metadata: labels: ~ @@ -40,81 +28,81 @@ service: externalTrafficPolicy: ~ externalIPs: ~ -# , , +# vpc_id, lb_name, arn_id ingress: host: example.com ingressClassName: alb metadata: labels: ~ - annotations: - alb.ingress.kubernetes.io/vpc-id: - alb.ingress.kubernetes.io/scheme: internet-facing - alb.ingress.kubernetes.io/target-type: ip - alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]' - alb.ingress.kubernetes.io/load-balancer-name: - alb.ingress.kubernetes.io/tags: Name= + annotations: ~ + # alb.ingress.kubernetes.io/vpc-id: vpc_id + # alb.ingress.kubernetes.io/scheme: internet-facing + # alb.ingress.kubernetes.io/target-type: ip + # alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}, {"HTTP":80}]' + # alb.ingress.kubernetes.io/load-balancer-name: lb_name + # alb.ingress.kubernetes.io/tags: Name=lb_name - alb.ingress.kubernetes.io/certificate-arn: - alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-2016-08 + # # alb.ingress.kubernetes.io/certificate-arn: arn_id + # alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-2016-08 - kubernetes.io/ingress.class: alb - alb.ingress.kubernetes.io/healthcheck-protocol: HTTP - alb.ingress.kubernetes.io/healthcheck-port: traffic-port + # kubernetes.io/ingress.class: alb + # alb.ingress.kubernetes.io/healthcheck-protocol: HTTP + # alb.ingress.kubernetes.io/healthcheck-port: traffic-port - alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15' - alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5' - alb.ingress.kubernetes.io/success-codes: '200' - alb.ingress.kubernetes.io/healthy-threshold-count: '2' - alb.ingress.kubernetes.io/unhealthy-threshold-count: '2' + # alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15' + # alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5' + # alb.ingress.kubernetes.io/success-codes: '200' + # alb.ingress.kubernetes.io/healthy-threshold-count: '2' + # alb.ingress.kubernetes.io/unhealthy-threshold-count: '2' - alb.ingress.kubernetes.io/backend-protocol: HTTP - alb.ingress.kubernetes.io/target-type: instance - alb.ingress.kubernetes.io/ip-address-type: ipv4 - alb.ingress.kubernetes.io/ssl-redirect: '443' - alb.ingress.kubernetes.io/actions.ssl-redirect: | - { - "Type": "redirect", - "RedirectConfig": { - "Protocol": "HTTPS", - "Port": "443", - "StatusCode": "HTTP_301" - }} - } - alb.ingress.kubernetes.io/actions.default: | - { - "type": "forward", - "forwardConfig": { - "targetGroups": [ - { - "serviceName": "", - "servicePort": 80, - "weight": 100 - } - ], - "targetGroupStickinessConfig": { - "enabled": false - } - } - } + # alb.ingress.kubernetes.io/backend-protocol: HTTP + # alb.ingress.kubernetes.io/target-type: instance + # alb.ingress.kubernetes.io/ip-address-type: ipv4 + # alb.ingress.kubernetes.io/ssl-redirect: '443' + # alb.ingress.kubernetes.io/actions.ssl-redirect: | + # { + # "Type": "redirect", + # "RedirectConfig": { + # "Protocol": "HTTPS", + # "Port": "443", + # "StatusCode": "HTTP_301" + # }} + # } + # alb.ingress.kubernetes.io/actions.default: | + # { + # "type": "forward", + # "forwardConfig": { + # "targetGroups": [ + # { + # "serviceName": "lb_name", + # "servicePort": 80, + # "weight": 100 + # } + # ], + # "targetGroupStickinessConfig": { + # "enabled": false + # } + # } + # } - alb.ingress.kubernetes.io/actions.: | - { - "type": "forward", - "forwardConfig": { - "targetGroups": [ - { - "serviceName": "", - "servicePort": 80, - "weight": 100 - } - ], - "targetGroupStickinessConfig": { - "enabled": false - } - } - } + # alb.ingress.kubernetes.io/actions.lb_name: | + # { + # "type": "forward", + # "forwardConfig": { + # "targetGroups": [ + # { + # "serviceName": "lb_name", + # "servicePort": 80, + # "weight": 100 + # } + # ], + # "targetGroupStickinessConfig": { + # "enabled": false + # } + # } + # } spec: selector: ~ @@ -124,7 +112,7 @@ persistVolume: size: 1Gi volumemode: FileSystem accessmode: ReadWriteMany - persistentvolumereclaimpolicy: Retain + persistentVolumeReclaimPolicy: Retain storageClass: efs-sc csi: driver: efs.csi.aws.com