-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathelassandra-statefulset.yaml
121 lines (118 loc) · 3.76 KB
/
elassandra-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
---
apiVersion: "apps/v1beta1"
kind: StatefulSet
metadata:
name: elassandra
spec:
serviceName: elassandra
replicas: 3
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: elassandra
spec:
# See https://pracucci.com/graceful-shutdown-of-kubernetes-pods.html
terminationGracePeriodSeconds: 300
securityContext:
# allows read/write access for mounted volumes
# by users that belong to a group with gid: 999
fsGroup: 999
initContainers:
- name: increase-vm-max-map-count
image: busybox
imagePullPolicy: IfNotPresent
command: ["sysctl", "-w", "vm.max_map_count=1048575"]
securityContext:
privileged: true
- name: increase-ulimit
image: busybox
command: [ "sh","-c","ulimit -l unlimited" ]
securityContext:
privileged: true
containers:
- name: elassandra
image: strapdata/elassandra:5.5.0.22-rc1
imagePullPolicy: Always
securityContext:
privileged: false
# applying fix in: https://github.com/kubernetes/kubernetes/issues/3595#issuecomment-287692878
# https://docs.docker.com/engine/reference/run/#operator-exclusive-options
capabilities:
add: ["IPC_LOCK", "SYS_RESOURCE"]
livenessProbe:
tcpSocket:
port: 7000
initialDelaySeconds: 15
periodSeconds: 5
readinessProbe:
exec:
command: [ "/bin/bash", "-c", "/ready-probe.sh" ]
initialDelaySeconds: 15
timeoutSeconds: 5
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "exec nodetool drain"]
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
- containerPort: 9200
name: http
protocol: TCP
- containerPort: 9300
name: transport
protocol: TCP
env:
# environment variables to be directly refrenced from the configuration
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: CASSANDRA_SEEDS
value: elassandra-0.elassandra.default.svc.cluster.local
- name: MAX_HEAP_SIZE
value: 2048M
- name: HEAP_NEWSIZE
value: 512M
- name: CASSANDRA_CLUSTER_NAME
value: "Cassandra"
- name: CASSANDRA_DC
value: "DC1"
- name: CASSANDRA_RACK
value: "r1"
- name: CASSANDRA_ENDPOINT_SNITCH
value: GossipingPropertyFileSnitch
# - name: CASSANDRA_DAEMON
# value: "org.apache.cassandra.service.CassandraDaemon"
# logging variables
- name: LOGBACK_org_elassandra_discovery
value: DEBUG
volumeMounts:
- name: elassandra-data
mountPath: /var/lib/cassandra
volumeClaimTemplates:
- metadata:
name: elassandra-data
spec:
accessModes: ["ReadWriteOnce"]
# Define your own storageClassName if needed.
storageClassName: managed-premium
resources:
requests:
storage: 16Gi