Add Gatus.

This commit is contained in:
Joseph Hanson 2024-04-07 09:05:08 -05:00
parent 2abbff0ea0
commit 0e45c87bfd
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
7 changed files with 248 additions and 1 deletions

View file

@ -0,0 +1,20 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/external-secrets.io/externalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: gatus
spec:
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-connect
target:
name: gatus-secret
template:
engineVersion: v2
data:
CUSTOM_PUSHOVER_TOKEN: "{{ .gatus_token }}"
CUSTOM_PUSHOVER_USER_KEY: "{{ .userkey_jahanson }}"
dataFrom:
- extract:
key: pushover

View file

@ -0,0 +1,117 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: gatus
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 3.1.0
sourceRef:
kind: HelmRepository
name: bjw-s
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
controllers:
gatus:
annotations:
reloader.stakater.com/auto: "true"
containers:
app:
image:
repository: ghcr.io/twin/gatus
tag: v5.8.0@sha256:fecb4c38722df59f5e00ab4fcf2393d9b8dad9161db208d8d79386dc86da8a55
env:
TZ: America/Chicago
GATUS_CONFIG_PATH: /config
GATUS_DELAY_START_SECONDS: 5
CUSTOM_WEB_PORT: &port 80
envFrom:
- secretRef:
name: gatus-secret
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /health
port: *port
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
resources:
requests:
cpu: 10m
limits:
memory: 256Mi
pod:
dnsConfig:
options:
- { name: ndots, value: "1" }
securityContext:
runAsUser: 568
runAsGroup: 568
runAsNonRoot: true
fsGroup: 568
fsGroupChangePolicy: OnRootMismatch
service:
app:
controller: gatus
ports:
http:
port: *port
serviceMonitor:
app:
serviceName: gatus
endpoints:
- port: http
scheme: http
path: /metrics
interval: 1m
scrapeTimeout: 10s
ingress:
app:
className: external
annotations:
external-dns.alpha.kubernetes.io/cloudflare-proxied: "true"
external-dns.alpha.kubernetes.io/target: external.hsn.dev
hosts:
- host: &host status.hsn.dev
paths:
- path: /
service:
identifier: app
port: http
tls:
- hosts: [*host]
serviceAccount:
create: true
name: gatus
persistence:
config:
type: emptyDir
config-file:
type: configMap
name: gatus-configmap
globalMounts:
- path: /config/config.yaml
subPath: config.yaml
readOnly: true

View file

@ -0,0 +1,14 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./externalsecret.yaml
- ./helmrelease.yaml
- ../../../../templates/postgres-database
configMapGenerator:
- name: gatus-configmap
files:
- config.yaml=./resources/config.yml
generatorOptions:
disableNameSuffixHash: true

View file

@ -0,0 +1,20 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/external-secrets.io/pushsecret_v1alpha1.json
apiVersion: external-secrets.io/v1alpha1
kind: PushSecret
metadata:
name: thanos
spec:
refreshInterval: 1h
secretStoreRefs:
- name: onepassword-connect
kind: ClusterSecretStore
selector:
secret:
name: gatus-pguser-gatus
data:
- match:
secretKey: uri
remoteRef:
remoteKey: gatus
property: DATABASE_URI

View file

@ -0,0 +1,47 @@
---
# Note: Gatus vars should be escaped with $${VAR_NAME} to avoid interpolation by Flux
web:
port: $${CUSTOM_WEB_PORT}
storage:
type: postgres
path: $${DATABASE_URI}
caching: true
metrics: true
debug: false
ui:
title: Status | Gatus
header: Status
alerting:
pushover:
application-token: $${CUSTOM_PUSHOVER_TOKEN}
user-key: $${CUSTOM_PUSHOVER_USER_KEY}
default-alert:
description: health-check failed
send-on-resolved: true
failure-threshold: 5
success-threshold: 2
connectivity:
checker:
target: 1.1.1.1:53
interval: 1m
endpoints:
- name: status
group: external
url: https://status.hsn.dev
interval: 1m
client:
dns-resolver: tcp://1.1.1.1:53
conditions:
- "[STATUS] == 200"
alerts:
- type: pushover
- name: flux-webhook
group: external
url: https://flux-webhook.hsn.dev
interval: 1m
client:
dns-resolver: tcp://1.1.1.1:53
conditions:
- "[STATUS] == 404"
alerts:
- type: pushover

View file

@ -0,0 +1,29 @@
---
# yaml-language-server: $schema=https://kubernetes-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app gatus
namespace: flux-system
spec:
targetNamespace: observability
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: crunchy-postgres-operator
- name: external-secrets-stores
path: ./kubernetes/apps/observability/gatus/app
prune: true
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: false
interval: 30m
retryInterval: 1m
timeout: 5m
postBuild:
substitute:
APP: *app
DB_NAME: gatus
DB_USER: gatus

View file

@ -7,7 +7,7 @@ resources:
- ./namespace.yaml - ./namespace.yaml
# Flux-Kustomizations # Flux-Kustomizations
- ./alertmanager-silencer/ks.yaml - ./alertmanager-silencer/ks.yaml
# - ./gatus/ks.yaml - ./gatus/ks.yaml
- ./grafana/ks.yaml - ./grafana/ks.yaml
- ./kube-prometheus-stack/ks.yaml - ./kube-prometheus-stack/ks.yaml
- ./loki/ks.yaml - ./loki/ks.yaml