Skip to content

Instantly share code, notes, and snippets.

@andrewjjenkins
Created February 19, 2019 22:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrewjjenkins/491cf40e0e412c06c491356a22307a43 to your computer and use it in GitHub Desktop.
Save andrewjjenkins/491cf40e0e412c06c491356a22307a43 to your computer and use it in GitHub Desktop.
an example cassandra config that works for aspenmesh/istio 1.0.4
apiVersion: v1
kind: Namespace
metadata:
name: cassandra
---
apiVersion: v1
kind: Service
metadata:
labels:
app: cassandra
namespace: cassandra
name: cassandra
spec:
clusterIP: None
ports:
- name: tcp-client
port: 9042
- port: 7000
name: tcp-intra-node
- port: 7001
name: tcp-tls-intra-node
- port: 7199
name: tcp-jmx
selector:
app: cassandra
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: cassandra
name: cassandra
labels:
app: cassandra
spec:
serviceName: cassandra
replicas: 3
selector:
matchLabels:
app: cassandra
template:
metadata:
labels:
app: cassandra
spec:
terminationGracePeriodSeconds: 1800
containers:
- name: cassandra
image: gcr.io/google-samples/cassandra:v13
imagePullPolicy: Always
command: [ "/usr/bin/dumb-init", "/bin/bash", "-c", "sed -i 's/^CASSANDRA_LISTEN_ADDRESS=.*/CASSANDRA_LISTEN_ADDRESS=\"127.0.0.1\"/' /run.sh && /run.sh" ]
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
- nodetool drain
env:
- name: MAX_HEAP_SIZE
value: 512M
- name: HEAP_NEWSIZE
value: 100M
- name: CASSANDRA_SEEDS
value: "cassandra-0.cassandra.cassandra.svc.cluster.local"
- name: CASSANDRA_CLUSTER_NAME
value: "K8Demo"
- name: CASSANDRA_DC
value: "DC1-K8Demo"
- name: CASSANDRA_RACK
value: "Rack1-K8Demo"
- 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
volumeClaimTemplates:
- metadata:
name: cassandra-data
spec:
accessModes: [ "ReadWriteOnce" ]
# storageClassName: fast
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cqlsh
namespace: cassandra
labels:
app: cqlsh
spec:
replicas: 1
selector:
matchLabels:
app: cqlsh
template:
metadata:
labels:
app: cqlsh
spec:
containers:
- name: cassandra
image: cassandra:3
command: [ "/bin/sleep", "720000" ]
# Test with kc exec -it -n cassandra cqlsh-78f48f4f6f-2tfgp -- /bin/bash -c "cqlsh -e \"DESCRIBE TABLES;\" cassandra.cassandra.svc.cluster.local"
#
# Keyspace system_traces
# ----------------------
# events sessions
#
# Keyspace system_schema
# ----------------------
# tables triggers views keyspaces dropped_columns
# functions aggregates indexes types columns
#
# Keyspace system_auth
# --------------------
# resource_role_permissons_index role_permissions role_members roles
#
# Keyspace system
# ---------------
# available_ranges peers batchlog transferred_ranges
# batches compaction_history size_estimates hints
# prepared_statements sstable_activity built_views
# "IndexInfo" peer_events range_xfers
# views_builds_in_progress paxos local
#
# Keyspace system_distributed
# ---------------------------
# repair_history view_build_status parent_repair_history
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cqlsh-noistio
namespace: cassandra
labels:
app: cqlsh-noistio
spec:
replicas: 1
selector:
matchLabels:
app: cqlsh-noistio
template:
metadata:
labels:
app: cqlsh-noistio
annotations:
sidecar.istio.io/inject: "false"
spec:
containers:
- name: cassandra
image: cassandra:3
command: [ "/bin/sleep", "720000" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment