Skip to content

Instantly share code, notes, and snippets.

@ahawkins
Last active September 4, 2018 06:34
Show Gist options
  • Save ahawkins/f8b2b6d330fdd4511fe1e285fb0ab9e3 to your computer and use it in GitHub Desktop.
Save ahawkins/f8b2b6d330fdd4511fe1e285fb0ab9e3 to your computer and use it in GitHub Desktop.
SycllaDB Kubenetes Examples
apiVersion: v1
kind: ConfigMap
metadata:
name: scylla
data:
readiness-probe: |
#!/usr/bin/env bash
set -euo pipefail
if [[ "$(nodetool status | grep "${POD_IP}")" == *"UN"* ]]; then
exit 0;
else
exit 1;
fi
apiVersion: v1
kind: Service
metadata:
labels:
app: scylla
name: scylla
spec:
clusterIP: None
ports:
- port: 9042
selector:
app: scylla
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: scylla
labels:
app: scylla
spec:
serviceName: scylla
replicas: 3
selector:
matchLabels:
app: scylla
template:
metadata:
labels:
app: scylla
spec:
containers:
- name: scylla
image: scylladb/scylla:2.2.0
imagePullPolicy: IfNotPresent
args: ["--seeds", "scylla-0.scylla.default.svc.cluster.local"]
ports:
- containerPort: 7000
name: intra-node
- containerPort: 7001
name: tls-intra-node
- containerPort: 7199
name: jmx
- containerPort: 9042
name: cql
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 500m
memory: 1Gi
securityContext:
capabilities:
add:
- IPC_LOCK
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "PID=$(pidof scylla) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
readinessProbe:
exec:
command:
- bash
- /opt/probes/readiness
initialDelaySeconds: 15
timeoutSeconds: 5
volumeMounts:
- name: scylla-data
mountPath: /var/lib/scylla
- name: scylla-probes
mountPath: /opt/probes
readOnly: true
volumes:
- name: scylla-probes
configMap:
name: scylla
items:
- key: readiness-probe
path: readiness
volumeClaimTemplates:
- metadata:
name: scylla-data
annotations:
volume.beta.kubernetes.io/storage-class: scylla-ssd
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: scylla-ssd
provisioner: kubernetes.io/gce-pd
parameters:
type: pd-ssd
zone: asia-southeast1-a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment