diff --git a/Chapter_Four/Lecture_11_Lab/cassandra/cassandra-service.yaml b/Chapter_Four/Lecture_11_Lab/cassandra/cassandra-service.yaml new file mode 100644 index 0000000..d7538bd --- /dev/null +++ b/Chapter_Four/Lecture_11_Lab/cassandra/cassandra-service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: cassandra + labels: + app: cassandra +spec: + clusterIP: None + ports: + - port: 9042 + selector: + app: cassandra + diff --git a/Chapter_Four/Lecture_11_Lab/cassandra/cassandra-statefulset.yaml b/Chapter_Four/Lecture_11_Lab/cassandra/cassandra-statefulset.yaml new file mode 100644 index 0000000..a500e41 --- /dev/null +++ b/Chapter_Four/Lecture_11_Lab/cassandra/cassandra-statefulset.yaml @@ -0,0 +1,86 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + 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 + 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.default.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 + volumeMounts: + - name: cassandra-data + mountPath: /cassandra_data + volumeClaimTemplates: + - metadata: + name: cassandra-data + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: fast + resources: + requests: + storage: 1Gi + diff --git a/Chapter_Four/Lecture_11_Lab/cassandra/ceph-class.yaml b/Chapter_Four/Lecture_11_Lab/cassandra/ceph-class.yaml new file mode 100644 index 0000000..8f9be70 --- /dev/null +++ b/Chapter_Four/Lecture_11_Lab/cassandra/ceph-class.yaml @@ -0,0 +1,20 @@ +apiVersion: ceph.rook.io/v1 +kind: CephBlockPool +metadata: + name: replicapool + namespace: rook-ceph +spec: + failureDomain: host + replicated: + size: 3 +--- +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: rook-ceph-block +provisioner: ceph.rook.io/block +parameters: + pool: replicapool + clusterNamespace: rook-ceph + fstype: xfs + diff --git a/Chapter_Four/Lecture_11_Lab/cassandra/ceph-cluster.yaml b/Chapter_Four/Lecture_11_Lab/cassandra/ceph-cluster.yaml new file mode 100644 index 0000000..bf44ecb --- /dev/null +++ b/Chapter_Four/Lecture_11_Lab/cassandra/ceph-cluster.yaml @@ -0,0 +1,19 @@ +apiVersion: ceph.rook.io/v1 +kind: CephCluster +metadata: + name: rook-ceph + namespace: rook-ceph +spec: + cephVersion: + image: ceph/ceph:v14.2 + dataDirHostPath: /var/lib/rook + mon: + count: 3 + dashboard: + enabled: true + storage: + useAllNodes: true + useAllDevices: false + directories: + - path: /var/lib/rook + diff --git a/Chapter_Four/Lecture_11_Lab/cassandra/ssd-class.yaml b/Chapter_Four/Lecture_11_Lab/cassandra/ssd-class.yaml new file mode 100644 index 0000000..d0ef455 --- /dev/null +++ b/Chapter_Four/Lecture_11_Lab/cassandra/ssd-class.yaml @@ -0,0 +1,8 @@ +apiVersion: storage.k8s.io/v1 +kind: StorageClass +metadata: + name: fast +provisioner: kubernetes.io/gce-pd +parameters: + type: pd-ssd +