Add deployment example for Kubernetes

This commit is contained in:
TwinProduction 2020-11-11 20:18:54 -05:00
parent 7699552c5b
commit 3773f952a8
3 changed files with 116 additions and 20 deletions

View File

@ -22,13 +22,14 @@ core applications: https://status.twinnation.org/
- [Conditions](#conditions) - [Conditions](#conditions)
- [Placeholders](#placeholders) - [Placeholders](#placeholders)
- [Functions](#functions) - [Functions](#functions)
- [Kubernetes (ALPHA)](#kubernetes-alpha)
- [Auto Discovery](#auto-discovery)
- [Alerting](#alerting) - [Alerting](#alerting)
- [Configuring Slack alerts](#configuring-slack-alerts) - [Configuring Slack alerts](#configuring-slack-alerts)
- [Configuring PagerDuty alerts](#configuring-pagerduty-alerts) - [Configuring PagerDuty alerts](#configuring-pagerduty-alerts)
- [Configuring Twilio alerts](#configuring-twilio-alerts) - [Configuring Twilio alerts](#configuring-twilio-alerts)
- [Configuring custom alerts](#configuring-custom-alerts) - [Configuring custom alerts](#configuring-custom-alerts)
- [Kubernetes (ALPHA)](#kubernetes-alpha)
- [Auto Discovery](#auto-discovery)
- [Deploying](#deploying)
- [Docker](#docker) - [Docker](#docker)
- [Running the tests](#running-the-tests) - [Running the tests](#running-the-tests)
- [Using in Production](#using-in-production) - [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 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. to map `potato.example.com` to the `potato` service.
#### Deploying
See [example/kubernetes-with-auto-discovery](example/kubernetes-with-auto-discovery)
## Docker ## Docker

View File

@ -14,21 +14,3 @@ services:
- "[STATUS] == 200" - "[STATUS] == 200"
- "[BODY].deleted == false" - "[BODY].deleted == false"
- "len([BODY].text) > 0" - "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

View File

@ -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