-
Notifications
You must be signed in to change notification settings - Fork 1
/
03-cassandra.yaml
161 lines (159 loc) · 4.23 KB
/
03-cassandra.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# ##### Cassandra LoadBalancer Service #####
# ---
# apiVersion: v1
# kind: Service
# metadata:
# name: cassandra-lb
# labels:
# app: cassandra-lb
# namespace: kong-appgw
# spec:
# type: LoadBalancer
# loadBalancerSourceRanges:
# - 0.0.0.0/0
# ports:
# - name: cassandra-lb
# port: 19042
# targetPort: 9042
# protocol: TCP
# selector:
# app: cassandra
##### Cassandra Service #####
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
name: cassandra
namespace: kong-appgw
spec:
clusterIP: None
ports:
- port: 9042
selector:
app: cassandra
##### Cassandra StatefulSet Template #####
---
apiVersion: "apps/v1beta1"
kind: StatefulSet
metadata:
name: cassandra
namespace: kong-appgw
spec:
serviceName: cassandra
replicas: 3
template:
metadata:
labels:
app: cassandra
spec:
containers:
- name: cassandra
image: gcr.io/google-samples/cassandra:v13
imagePullPolicy: Always
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
resources:
limits:
cpu: "2"
memory: 4Gi
requests:
cpu: "500m"
memory: 1Gi
securityContext:
capabilities:
add:
- IPC_LOCK
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
env:
- name: CASSANDRA_DC
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_data_center
- name: CASSANDRA_RACK
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_rack_name
- name: CASSANDRA_CLUSTER_NAME
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_cluster_name
- name: CASSANDRA_SEEDS
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_seeds
- name: CASSANDRA_AUTO_BOOTSTRAP
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_auto_bootstrap
- name: MAX_HEAP_SIZE
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_max_heap_size
- name: HEAP_NEWSIZE
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_heap_newsize
- name: CASSANDRA_USER
valueFrom:
configMapKeyRef:
name: kong-configmap
key: cassandra_user
- name: CASSANDRA_PASSWORD
valueFrom:
secretKeyRef:
name: kong-secrets
key: cassandra_pass
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- /ready-probe.sh
initialDelaySeconds: 15
timeoutSeconds: 5
### 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: cassandra-data
mountPath: /cassandra_data
### 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
### https://kubernetes.io/docs/concepts/storage/storage-classes
volumeClaimTemplates:
- metadata:
name: cassandra-data
annotations:
volume.beta.kubernetes.io/storage-class: gcp-storage
spec:
### https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes
accessModes: [ "ReadWriteOnce" ]
# accessModes: [ "ReadOnlyMany" ]
# accessModes: [ "ReadWriteMany" ]
resources:
requests:
storage: 10Gi