--- 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