Skip to content

Commit 100145b

Browse files
committed
docs: add k8s docs
closes #550 closes #927 closes #652
1 parent 72a26b4 commit 100145b

File tree

2 files changed

+119
-4
lines changed

2 files changed

+119
-4
lines changed

docs/content/_index.html

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
{{< blocks/cover title="Welcome to Gravity" image_anchor="top" >}}
77
<div class="mx-auto">
88
<a class="btn btn-lg btn-primary mr-3 mb-4" href="{{< relref "/docs/install">}}">
9-
Learn More <i class="fas fa-arrow-alt-circle-right ml-2"></i>
10-
</a>
11-
<a class="btn btn-lg btn-secondary mr-3 mb-4" href="https://github.com/BeryJu/gravity/tags">
12-
Download <i class="fab fa-github ml-2 "></i>
9+
Get started <i class="fas fa-arrow-alt-circle-right ml-2"></i>
1310
</a>
1411
<p class="lead mt-5" style="color: black;">Fully-replicated DNS, DHCP and TFTP Server powered by etcd!</p>
1512
{{< blocks/link-down color="info" >}}
+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: "Kubernetes"
3+
---
4+
5+
Gravity can be run in Kubernetes, either as a single node or as a cluster.
6+
7+
## Single node
8+
9+
For a single node instance, the Gravity container can be deployed as-is.
10+
11+
Note that to use DHCP when running in Kubernetes, it is recommended to deploy a DHCP on the router and have it forward requests to Gravity's LoadBalancer IP.
12+
13+
See the example deployment below:
14+
15+
```yaml
16+
apiVersion: v1
17+
kind: Namespace
18+
metadata:
19+
name: gravity
20+
---
21+
apiVersion: v1
22+
kind: Service
23+
metadata:
24+
name: gravity
25+
namespace: gravity
26+
labels:
27+
app.kubernetes.io/name: gravity
28+
spec:
29+
selector:
30+
app.kubernetes.io/name: gravity
31+
ports:
32+
- protocol: UDP
33+
port: 53
34+
targetPort: 53
35+
name: dns
36+
- protocol: TCP
37+
port: 53
38+
targetPort: 53
39+
name: dnstcp
40+
- port: 67
41+
targetPort: 67
42+
name: dhcp
43+
protocol: UDP
44+
- port: 69
45+
targetPort: 69
46+
name: tftp
47+
protocol: UDP
48+
- port: 8008
49+
targetPort: 8008
50+
name: http
51+
protocol: TCP
52+
type: LoadBalancer
53+
---
54+
apiVersion: apps/v1
55+
kind: StatefulSet
56+
metadata:
57+
name: gravity
58+
namespace: gravity
59+
spec:
60+
selector:
61+
matchLabels:
62+
app.kubernetes.io/name: gravity
63+
spec:
64+
containers:
65+
- name: gravity
66+
image: ghcr.io/beryju/gravity:stable
67+
env:
68+
- name: BOOTSTRAP_ROLES
69+
value: dns;dhcp;api;discovery;backup;monitoring;tsdb;tftp
70+
- name: INSTANCE_IP
71+
value: <insert loadbalancer IP of gravity>
72+
- name: INSTANCE_LISTEN
73+
value: 0.0.0.0
74+
livenessProbe:
75+
httpGet:
76+
path: /healthz/live
77+
port: http-metrics
78+
readinessProbe:
79+
httpGet:
80+
path: /healthz/ready
81+
port: http-metrics
82+
ports:
83+
- containerPort: 53
84+
name: dns-tcp
85+
- containerPort: 53
86+
protocol: UDP
87+
name: dns-udp
88+
- containerPort: 67
89+
protocol: UDP
90+
name: dhcp
91+
- containerPort: 68
92+
protocol: UDP
93+
name: dhcp-alt
94+
- containerPort: 69
95+
protocol: UDP
96+
name: tftp
97+
- containerPort: 8008
98+
name: http
99+
- containerPort: 8009
100+
name: http-metrics
101+
volumeMounts:
102+
- name: data
103+
mountPath: /data
104+
volumeClaimTemplates:
105+
- metadata:
106+
name: data
107+
spec:
108+
accessModes: ["ReadWriteOnce"]
109+
resources:
110+
requests:
111+
storage: 1Gi
112+
```
113+
114+
## Multi-node cluster
115+
116+
When running a multi-node Gravity cluster in Kubernetes, it is recommended to not use the built-in etcd server in Gravity. This is because the built-in cluster management is optimized for static nodes and simplicity and as such doesn't offer enough dynamic options that Kubernetes requires.
117+
118+
It is recommended to use either an etcd Operator like [this](https://etcd.aenix.io/) or [this](https://operatorhub.io/operator/etcd), deploy etcd manually, or use Kubernetes' etcd with Gravity.

0 commit comments

Comments
 (0)