Skip to content

Instantly share code, notes, and snippets.

@wingadium1
Last active Aug 17, 2021
Embed
What would you like to do?
Cassandraa Multi Data Center
---
apiVersion: "apps/v1"
kind: StatefulSet
metadata:
name: cassandraa
spec:
serviceName: cassandra
replicas: 2
selector:
matchLabels:
app: cassandra
template:
metadata:
labels:
app: cassandra
interface: cassandraa
spec:
volumes:
- name: cassandra-probe-config
configMap:
name: cassandra-probe-config
items:
- key: probe
path: ready-probe.sh
mode: 0777
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- ap-southeast-1a
containers:
- name: cassandra
image: cassandra:3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
securityContext:
capabilities:
add:
- IPC_LOCK
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- nodetool drain
env:
- name: CASSANDRA_SEEDS
value: cassandraa-0.cassandra.thingsboard.svc.cluster.local,cassandrab-0.cassandra.thingsboard.svc.cluster.local,cassandrac-0.cassandra.thingsboard.svc.cluster.local
- name: MAX_HEAP_SIZE
value: 256M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_CLUSTER_NAME
value: "Cassandra"
- name: CASSANDRA_DC
value: "ap-southeast-1a"
- name: CASSANDRA_RACK
value: "Rack1"
- name: CASSANDRA_ENDPOINT_SNITCH
value: GossipingPropertyFileSnitch
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumeMounts:
- name: cassandra-data
mountPath: /var/lib/cassandra/data
- name: cassandra-probe-config
mountPath: /probe
volumeClaimTemplates:
- metadata:
name: cassandra-data
spec:
storageClassName: "gp2-delete"
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
---
apiVersion: "apps/v1"
kind: StatefulSet
metadata:
name: cassandrab
spec:
serviceName: cassandrab
replicas: 1
selector:
matchLabels:
app: cassandra
template:
metadata:
labels:
app: cassandra
interface: cassandrab
spec:
volumes:
- name: cassandra-probe-config
configMap:
name: cassandra-probe-config
items:
- key: probe
path: ready-probe.sh
mode: 0777
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- ap-southeast-1b
containers:
- name: cassandra
image: cassandra:3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
securityContext:
capabilities:
add:
- IPC_LOCK
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- nodetool drain
env:
- name: CASSANDRA_SEEDS
value: cassandraa-0.cassandra.thingsboard.svc.cluster.local,cassandrab-0.cassandra.thingsboard.svc.cluster.local,cassandrac-0.cassandra.thingsboard.svc.cluster.local
- name: MAX_HEAP_SIZE
value: 256M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_CLUSTER_NAME
value: "Cassandra"
- name: CASSANDRA_DC
value: "ap-southeast-1b"
- name: CASSANDRA_RACK
value: "Rack1"
- name: CASSANDRA_ENDPOINT_SNITCH
value: GossipingPropertyFileSnitch
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumeMounts:
- name: cassandra-data
mountPath: /var/lib/cassandra/data
- name: cassandra-probe-config
mountPath: /probe
volumeClaimTemplates:
- metadata:
name: cassandra-data
spec:
storageClassName: "gp2-delete"
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 40Gi
---
apiVersion: "apps/v1"
kind: StatefulSet
metadata:
name: cassandrac
spec:
serviceName: cassandra
replicas: 1
selector:
matchLabels:
app: cassandra
template:
metadata:
labels:
app: cassandra
interface: cassandrac
spec:
volumes:
- name: cassandra-probe-config
configMap:
name: cassandra-probe-config
items:
- key: probe
path: ready-probe.sh
mode: 0777
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values:
- ap-southeast-1c
containers:
- name: cassandra
image: cassandra:3
imagePullPolicy: IfNotPresent
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
securityContext:
capabilities:
add:
- IPC_LOCK
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- nodetool drain
env:
- name: CASSANDRA_SEEDS
value: cassandraa-0.cassandra.thingsboard.svc.cluster.local,cassandrab-0.cassandra.thingsboard.svc.cluster.local,cassandrac-0.cassandra.thingsboard.svc.cluster.local
- name: MAX_HEAP_SIZE
value: 256M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_CLUSTER_NAME
value: "Cassandra"
- name: CASSANDRA_DC
value: "ap-southeast-1c"
- name: CASSANDRA_RACK
value: "Rack1"
- name: CASSANDRA_ENDPOINT_SNITCH
value: GossipingPropertyFileSnitch
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
volumeMounts:
- name: cassandra-data
mountPath: /var/lib/cassandra/data
- name: cassandra-probe-config
mountPath: /probe
volumeClaimTemplates:
- metadata:
name: cassandra-data
spec:
storageClassName: "gp2-delete"
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
name: cassandraa
spec:
clusterIP: None
ports:
- port: 9042
selector:
interface: cassandraa
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
name: cassandrab
spec:
clusterIP: None
ports:
- port: 9042
selector:
interface: cassandrab
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
name: cassandrac
spec:
clusterIP: None
ports:
- port: 9042
selector:
interface: cassandrac
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
name: cassandra
spec:
clusterIP: None
ports:
- port: 9042
selector:
app: cassandra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment