diff --git a/doc/k8s-testing.md b/doc/k8s-testing.md index f030d58..4b462ec 100644 --- a/doc/k8s-testing.md +++ b/doc/k8s-testing.md @@ -24,27 +24,30 @@ * [Config Map](#config-map-1) * [Stateful Set](#stateful-set-2) * [Service](#service-2) + * [Redis](#redis) + * [Stateful Set](#stateful-set-3) + * [Service](#service-3) * [Hlæja](#hlæja) * [Account Register](#account-register) * [Secret](#secret-2) * [Config Map](#config-map-2) * [Deployment](#deployment) - * [Service](#service-3) + * [Service](#service-4) * [Device Register](#device-register) * [Secret](#secret-3) * [Config Map](#config-map-3) * [Deployment](#deployment-1) - * [Service](#service-4) + * [Service](#service-5) * [Device Configuration](#device-configuration) * [Secret](#secret-4) * [Config Map](#config-map-4) * [Deployment](#deployment-2) - * [Service](#service-5) + * [Service](#service-6) * [Device Data](#device-data) * [Secret](#secret-5) * [Config Map](#config-map-5) * [Deployment](#deployment-3) - * [Service](#service-6) + * [Service](#service-7) ---- @@ -284,6 +287,32 @@ kubectl apply -f .\kube\02-databases\03-infulxdb\04-service.yaml --- +### Redis + +For now... run basic redis, we need to add authentication, replication later? need to think mor about this later. + +#### Stateful Set + +This is the specifications for redis. + +```bash +kubectl apply -f .\kube\02-databases\04-redis\01-statefulset.yaml +``` + +Set storage size for permanent storage. + +did add storage for restarts and some limits. + +#### Service + +this exposes port and ip. + +```bash +kubectl apply -f .\kube\02-databases\04-redis\02-service.yaml +``` + +--- + ## Hlæja To access service use `kubectl exec -it -n hlaeja -- /bin/sh` diff --git a/kube/02-databases/04-redis/01-statefulset.yaml b/kube/02-databases/04-redis/01-statefulset.yaml new file mode 100644 index 0000000..be9dbd2 --- /dev/null +++ b/kube/02-databases/04-redis/01-statefulset.yaml @@ -0,0 +1,43 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: redis + namespace: hlaeja + labels: + app: redis + environment: testing + tier: database +spec: + serviceName: redis + replicas: 1 + selector: + matchLabels: + app: redis + template: + metadata: + labels: + app: redis + spec: + containers: + - name: redis + image: redis:8.0.3-alpine + ports: + - containerPort: 6379 + resources: + requests: + memory: "256Mi" + cpu: "100m" + limits: + memory: "512Mi" + cpu: "500m" + volumeMounts: + - name: redis-data + mountPath: /data + volumeClaimTemplates: + - metadata: + name: redis-data + spec: + accessModes: ["ReadWriteOnce"] + resources: + requests: + storage: 1Gi diff --git a/kube/02-databases/04-redis/02-service.yaml b/kube/02-databases/04-redis/02-service.yaml new file mode 100644 index 0000000..d3a2c10 --- /dev/null +++ b/kube/02-databases/04-redis/02-service.yaml @@ -0,0 +1,21 @@ +apiVersion: v1 +kind: Service +metadata: + name: redis + namespace: hlaeja + labels: + app: redis + environment: testing + tier: database + annotations: + metallb.universe.tf/address-pool: default +spec: + type: LoadBalancer + loadBalancerIP: 10.0.3.144 + selector: + app: redis + ports: + - port: 6379 + targetPort: 6379 + protocol: TCP + name: cql