diff options
| author | 2024-04-15 23:31:41 +0100 | |
|---|---|---|
| committer | 2024-04-15 23:31:41 +0100 | |
| commit | c4eeae69b2ee88b64c886e4dd6563fd78b9f22d7 (patch) | |
| tree | a9f4d72c37d0c2ff359f96b51b67750fadbd162e /kubernetes/namespaces/default | |
| parent | Move Grafana to monitoring namespace (diff) | |
Move Redis to databases namespace
Diffstat (limited to 'kubernetes/namespaces/default')
| -rw-r--r-- | kubernetes/namespaces/default/redis/README.md | 34 | ||||
| -rw-r--r-- | kubernetes/namespaces/default/redis/configmap.yaml | 15 | ||||
| -rw-r--r-- | kubernetes/namespaces/default/redis/deployment.yaml | 58 | ||||
| -rw-r--r-- | kubernetes/namespaces/default/redis/redis.conf.template | 11 | ||||
| -rw-r--r-- | kubernetes/namespaces/default/redis/secrets.yaml | bin | 567 -> 0 bytes | |||
| -rw-r--r-- | kubernetes/namespaces/default/redis/service.yaml | 9 | ||||
| -rw-r--r-- | kubernetes/namespaces/default/redis/volume.yaml | 13 | 
7 files changed, 0 insertions, 140 deletions
| diff --git a/kubernetes/namespaces/default/redis/README.md b/kubernetes/namespaces/default/redis/README.md deleted file mode 100644 index d496758..0000000 --- a/kubernetes/namespaces/default/redis/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Python Discord Redis -This folder contains the configuration for Python Discord's Redis instance. - -## ConfigMap -**We'll need to create a ConfigMap for this service, which will hold the `redis.conf` configuration.** - -Do the following: -1. Make a copy of `redis.conf.template` called `redis.conf` -2. Edit your `redis.conf` to replace `<INSERT PASSWORD>` with the password you'd like your redis instance to use. -3. Use `kubectl create configmap redis-conf --from-file=redis.conf` to create the ConfigMap -4. Delete the `redis.conf`. **We don't wanna commit that password anywhere!** - -## Volume -A 10Gi volume is provisioned on the Linode Block Storage (Retain) storage class. - -## Deployment -The deployment will pull the `redis:latest` image from DockerHub. - -It will mount the created volume at `/data`. - -It will expose port `6379` to connect to Redis. - -## Service -A service called `redis` will be created to give the deployment a cluster local DNS record of `redis.default.svc.cluster.local`. - -## Secrets - -Redis requires a `redis-credentials` secret with the following entries: - -| Environment    | Description                           | -|----------------|---------------------------------------| -| REDIS_HOST     | The host redis is running on          | -| REDIS_PASSWORD | The password to connect to redis with | -| REDIS_PORT     | The port redis is listening on        | diff --git a/kubernetes/namespaces/default/redis/configmap.yaml b/kubernetes/namespaces/default/redis/configmap.yaml deleted file mode 100644 index 2a2f23e..0000000 --- a/kubernetes/namespaces/default/redis/configmap.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: -  name: redis-conf -  namespace: default -data: -  redis.conf: | -    # Store all commands used and replay on server startup -    appendonly yes - -    # Set working directory -    dir /data - -    # Set a memory maximum -    maxmemory 1gb diff --git a/kubernetes/namespaces/default/redis/deployment.yaml b/kubernetes/namespaces/default/redis/deployment.yaml deleted file mode 100644 index ef5d68c..0000000 --- a/kubernetes/namespaces/default/redis/deployment.yaml +++ /dev/null @@ -1,58 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: -  name: redis -spec: -  replicas: 1 -  strategy: -    type: Recreate -  selector: -    matchLabels: -      app: redis -  template: -    metadata: -      labels: -        app: redis -    spec: -      containers: -        - name: redis -          image: redis:latest -          command: -          - redis-server -          args: -          - /config/redis.conf -          - --requirepass -          - $(REDIS_PASSWORD) -          imagePullPolicy: Always -          resources: -            requests: -              cpu: 50m -              memory: 100Mi -            limits: -              cpu: 100m -              memory: 150Mi -          ports: -            - containerPort: 6379 -          envFrom: -            - secretRef: -                name: redis-credentials -          volumeMounts: -            - name: redis-data-volume -              mountPath: /data           # Must match the dir in the redis.conf -            - name: redis-config-volume -              mountPath: /config -          securityContext: -            readOnlyRootFilesystem: true - -      volumes: -        - name: redis-data-volume -          persistentVolumeClaim: -            claimName: redis-storage -        - name: redis-config-volume -          configMap: -            name: redis-conf - -      securityContext: -        fsGroup: 1000 -        runAsUser: 1000 -        runAsNonRoot: true diff --git a/kubernetes/namespaces/default/redis/redis.conf.template b/kubernetes/namespaces/default/redis/redis.conf.template deleted file mode 100644 index 6d8eeac..0000000 --- a/kubernetes/namespaces/default/redis/redis.conf.template +++ /dev/null @@ -1,11 +0,0 @@ -# Store all commands used and replay on server startup -appendonly yes - -# Set password -requirepass <INSERT PASSWORD> - -# Set working directory -dir /data - -# Set a memory maximum -maxmemory 1gb diff --git a/kubernetes/namespaces/default/redis/secrets.yaml b/kubernetes/namespaces/default/redis/secrets.yamlBinary files differ deleted file mode 100644 index 8e29358..0000000 --- a/kubernetes/namespaces/default/redis/secrets.yaml +++ /dev/null diff --git a/kubernetes/namespaces/default/redis/service.yaml b/kubernetes/namespaces/default/redis/service.yaml deleted file mode 100644 index 0be72e8..0000000 --- a/kubernetes/namespaces/default/redis/service.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: -  name: redis -spec: -  ports: -    - port: 6379  # Redis default port -  selector: -    app: redis diff --git a/kubernetes/namespaces/default/redis/volume.yaml b/kubernetes/namespaces/default/redis/volume.yaml deleted file mode 100644 index 6522ea6..0000000 --- a/kubernetes/namespaces/default/redis/volume.yaml +++ /dev/null @@ -1,13 +0,0 @@ -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: -  name: redis-storage -  labels: -    app: redis -spec: -  storageClassName: linode-block-storage-retain -  accessModes: -    - ReadWriteOnce -  resources: -    requests: -      storage: 10Gi | 
