diff --git a/README.md b/README.md index 86a94be6..722c9677 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,14 @@ core applications: https://status.twinnation.org/ - [Conditions](#conditions) - [Placeholders](#placeholders) - [Functions](#functions) - - [Kubernetes (ALPHA)](#kubernetes-alpha) - - [Auto Discovery](#auto-discovery) - [Alerting](#alerting) - [Configuring Slack alerts](#configuring-slack-alerts) - [Configuring PagerDuty alerts](#configuring-pagerduty-alerts) - [Configuring Twilio alerts](#configuring-twilio-alerts) - [Configuring custom alerts](#configuring-custom-alerts) + - [Kubernetes (ALPHA)](#kubernetes-alpha) + - [Auto Discovery](#auto-discovery) + - [Deploying](#deploying) - [Docker](#docker) - [Running the tests](#running-the-tests) - [Using in Production](#using-in-production) @@ -364,6 +365,10 @@ Note that `hostname-suffix` could also be something like `.yourdomain.com`, in w monitored would be `potato.example.com/health`, assuming you have a service named `potato` and a matching ingress to map `potato.example.com` to the `potato` service. +#### Deploying + +See [example/kubernetes-with-auto-discovery](example/kubernetes-with-auto-discovery) + ## Docker diff --git a/config.yaml b/config.yaml index 3689fb1d..e14b1006 100644 --- a/config.yaml +++ b/config.yaml @@ -14,21 +14,3 @@ services: - "[STATUS] == 200" - "[BODY].deleted == false" - "len([BODY].text) > 0" - -kubernetes: - cluster-mode: "out" - auto-discover: true - excluded-service-suffixes: - - canary - service-template: - interval: 30s - conditions: - - "[STATUS] == 200" - namespaces: - - name: default - hostname-suffix: ".default.svc.cluster.local" - target-path: "/health" - excluded-services: - - gatus - - kubernetes - - twinnation \ No newline at end of file diff --git a/example/kubernetes-with-auto-discovery/gatus.yaml b/example/kubernetes-with-auto-discovery/gatus.yaml new file mode 100644 index 00000000..d2bfdfb2 --- /dev/null +++ b/example/kubernetes-with-auto-discovery/gatus.yaml @@ -0,0 +1,109 @@ +apiVersion: v1 +data: + config.yaml: | + kubernetes: + cluster-mode: "in" + auto-discover: true + excluded-service-suffixes: + - canary + service-template: + interval: 30s + conditions: + - "[STATUS] == 200" + namespaces: + - name: default + hostname-suffix: ".default.svc.cluster.local" + target-path: "/health" + excluded-services: + - gatus +kind: ConfigMap +metadata: + name: gatus + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: gatus +rules: + - apiGroups: + - "" + resources: + - services + verbs: + - list + - get +--- +apiVersion: v1 +automountServiceAccountToken: true +kind: ServiceAccount +metadata: + name: gatus + namespace: kube-system +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: gatus +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: gatus +subjects: + - kind: ServiceAccount + name: gatus + namespace: kube-system +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gatus + namespace: kube-system +spec: + replicas: 1 + selector: + matchLabels: + k8s-app: gatus + template: + metadata: + labels: + k8s-app: gatus + name: gatus + namespace: kube-system + spec: + containers: + - image: twinproduction/gatus + imagePullPolicy: IfNotPresent + name: gatus + ports: + - containerPort: 8080 + name: http + protocol: TCP + resources: + limits: + cpu: 200m + memory: 50M + requests: + cpu: 50m + memory: 20M + volumeMounts: + - mountPath: /config + name: gatus-config + volumes: + - configMap: + name: gatus + name: gatus-config +--- +apiVersion: v1 +kind: Service +metadata: + name: gatus + namespace: kube-system +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + k8s-app: gatus \ No newline at end of file