diff --git a/doc/k8s-testing.md b/doc/k8s-testing.md index d3f6a3c..0777fef 100644 --- a/doc/k8s-testing.md +++ b/doc/k8s-testing.md @@ -16,17 +16,20 @@ * [Config Map](#config-map) * [Stateful Set](#stateful-set) * [Service](#service) + * [Cassandra](#cassandra) + * [Stateful Set](#stateful-set-1) + * [Service](#service-1) * [Hlæja](#hlæja) * [Account Register](#account-register) * [Secret](#secret-1) * [Config Map](#config-map-1) * [Deployment](#deployment) - * [Service](#service-1) + * [Service](#service-2) * [Device Register](#device-register) * [Secret](#secret-2) * [Config Map](#config-map-2) * [Deployment](#deployment-1) - * [Service](#service-2) + * [Service](#service-3) ---- @@ -167,6 +170,57 @@ kubectl apply -f .\kube\02-databases\01-postgres\04-service.yaml --- +### Cassandra + +For now... run basic cassandra, we need to add authentication later. + +to get a clean cassandra configuration: + +```bash +docker run --rm cassandra:5.0 cat /etc/cassandra/cassandra.yaml > cassandra-default.yaml +``` + +modify `authenticator` and `authorizer` and som how get that change inside... local file get to big 262144 bytes limitation. + +some help things for later + +```bashe +kubectl exec -it -n hlaeja cassandra-0 -- bash +``` + +run one of this + +```bash +nodetool status +``` + +or + +```bash +cqlsh +SELECT data_center FROM system.local; +``` + +#### Stateful Set + +This is the specifications for cassandra. + +```bash +kubectl apply -f .\kube\02-databases\02-cassandra\01-statefulset.yaml +``` + +Set storage size for permanent storage + +#### Service + +this exposes port and ip. + +```bash +kubectl apply -f .\kube\02-databases\02-cassandra\02-service.yaml +``` + +--- + ## Hlæja ### Account Register diff --git a/kube/02-databases/02-cassandra/01-statefulset.yaml b/kube/02-databases/02-cassandra/01-statefulset.yaml new file mode 100644 index 0000000..5c52526 --- /dev/null +++ b/kube/02-databases/02-cassandra/01-statefulset.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: cassandra + namespace: hlaeja + labels: + app: cassandra + environment: testing + tier: database +spec: + serviceName: cassandra + replicas: 1 + selector: + matchLabels: + app: cassandra + template: + metadata: + labels: + app: cassandra + spec: + terminationGracePeriodSeconds: 1800 + containers: + - name: cassandra + image: cassandra:5.0.4 + ports: + - containerPort: 9042 + volumeMounts: + - name: cassandra-data + mountPath: /var/lib/cassandra + volumeClaimTemplates: + - metadata: + name: cassandra-data + spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi diff --git a/kube/02-databases/02-cassandra/02-service.yaml b/kube/02-databases/02-cassandra/02-service.yaml new file mode 100644 index 0000000..0d14deb --- /dev/null +++ b/kube/02-databases/02-cassandra/02-service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: cassandra + namespace: hlaeja + labels: + app: cassandra + environment: testing + tier: database + annotations: + metallb.universe.tf/address-pool: default +spec: + type: LoadBalancer + loadBalancerIP: 10.0.3.142 + selector: + app: cassandra + ports: + - port: 9042 + targetPort: 9042 + protocol: TCP + name: cql