-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
arcadedb-statefulset.yaml
143 lines (142 loc) · 4.21 KB
/
arcadedb-statefulset.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# If you are running this on MacOSX, assure you have k8s desktop version. Run:
#
# > kubectl config use-context docker-for-desktop
#
# Overall Design:
# - a headless service to expose a DNS entry for discovery
# - a service to expose end-points to the outside world
# - the stateful set itself
# - a load-balancer service to balance the requests among the available nodes
#
# Using ArcadeDB with k8s
# - Create cluster : kubectl apply -f arcadedb-statefulset.yaml
# - List the pods : kubectl get pods
# - Run console : kubectl exec -it arcadedb-0 -- bin/console.sh
# - Destroy cluster : kubectl delete -f arcadedb-replica.yaml
apiVersion: v1
kind: Namespace
metadata:
name: arcadedb
---
apiVersion: v1
kind: Service
metadata:
name: arcadedb-http
labels:
app: arcadedb
spec:
clusterIP:
ports:
- name: http
port: 2480
selector:
app: arcadedb
type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
# This is a "headless" service for the arcadedb which exists to allow discovery of the set of
# member pods (masters). The CNAME of this service points to SRV records - one for each Pod that
# is Running and Ready). Read more in the Kubernetes docs:
# https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/
name: arcadedb
labels:
app: arcadedb
spec:
clusterIP: None
ports:
- name: http
port: 2480
targetPort: 2480
- name: rpc
port: 2424
targetPort: 2424
selector:
app: arcadedb
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: arcadedb
labels:
app: arcadedb
spec:
serviceName: arcadedb
podManagementPolicy: "OrderedReady"
replicas: 3
selector:
matchLabels:
app: arcadedb
template:
metadata:
labels:
app: arcadedb
spec:
affinity:
# Set the anti-affinity selector scope to arcadedb servers.
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- arcadedb
topologyKey: kubernetes.io/hostname
containers:
- name: arcadedb
image: arcadedata/arcadedb:latest
imagePullPolicy: IfNotPresent
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: rootPassword
valueFrom:
secretKeyRef:
key: rootPassword
name: arcadedb-credentials
optional: false
command:
- "bin/server.sh"
- "-Darcadedb.dumpConfigAtStartup=true"
- "-Darcadedb.server.name=${HOSTNAME}"
- "-Darcadedb.server.rootPassword=${rootPassword}"
- "-Darcadedb.server.databaseDirectory=/mnt/data0/databases"
- "-Darcadedb.server.defaultDatabases=Universe[elon:musk]"
- "-Darcadedb.ha.enabled=true"
- "-Darcadedb.ha.replicationIncomingHost=0.0.0.0"
- "-Darcadedb.ha.serverList=arcadedb-0.arcadedb.default.svc.cluster.local:2424"
- "-Darcadedb.ha.k8s=true"
- "-Darcadedb.ha.k8sSuffix=.arcadedb.default.svc.cluster.local"
resources:
requests:
memory: "512Mi"
ports:
- containerPort: 2480
name: http
- containerPort: 2424
name: rpc
# These volume mounts are persistent. They are like inline claims,
# but not exactly because the names need to match exactly one of
# the stateful pod volumes.
volumeMounts:
- name: datadir
mountPath: /mnt/data0
updateStrategy:
type: RollingUpdate
# These are converted to volume claims by the controller
# and mounted at the paths mentioned above.
# do not use these in production until ssd GCEPersistentDisk or other ssd pd
volumeClaimTemplates:
- metadata:
name: datadir
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 10Gi