Skip to content

Instantly share code, notes, and snippets.

@Vertiwell
Created November 15, 2021 03:11
Show Gist options
  • Save Vertiwell/e9277518cea1c01ba20025ab3b375e6f to your computer and use it in GitHub Desktop.
Save Vertiwell/e9277518cea1c01ba20025ab3b375e6f to your computer and use it in GitHub Desktop.
redis.sh
#!/bin/bash
### Deploying Redis Cluster on Kubernetes for Debian/Ubuntu based OS
## Baseline Guide: https://github.com/bitnami/charts/tree/master/bitnami/redis
# Type of Deployment: Helm
#
### Minimum Requirements ###
## Three Worker Node Cluster (Tested on K0s, K3s, K8s)
## A Storage Backend (Tested on Ceph, OpenEBS, Local, Longhorn)
#
## The following base packages are required:
# Helm, Package Manager
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && \
chmod 700 get_helm.sh && \
./get_helm.sh && \
#
### Installation ###
## Set Variables:
# Set a StorageClass (kubectl get sc)
STORAGE=rook-ceph-fs
# Install the Helm chart repo
helm repo add bitnami https://charts.bitnami.com/bitnami && helm repo update && \
# Create custom values file for the Redis Cluster Helm chart
# Helm Chart Values: https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml
cat <<EOF >redis-custom-values.yaml
global:
storageClass: $STORAGE
master:
persistence:
size: 2Gi
replica:
persistence:
size: 2Gi
sentinel:
enabled: true
EOF
helm install redis bitnami/redis -f redis-custom-values.yaml && \
### To get the password, run this command: kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 --decode
# Clean up
rm redis-custom-values.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment