Redis operator for Kubernetes with HAProxy support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vladimir Smagin 5e8130bc98 add logging to deletion pdb 1 month ago
build run 7 months ago
cmd/manager run 7 months ago
deploy add pdb to demo instance 1 month ago
pkg add logging to deletion pdb 1 month ago
vendor no more latest tag, use jenkins to build 3 months ago
version add PodDisruptionBudge resources 1 month ago
.gitignore run 7 months ago
Dockerfile move to ubuntu image 1 month ago
Jenkinsfile no more latest tag, use jenkins to build 3 months ago
README.md add additional condition for sentinel pdb 1 month ago
VERSION add PodDisruptionBudge resources 1 month ago
go.mod no more latest tag, use jenkins to build 3 months ago
go.sum no more latest tag, use jenkins to build 3 months ago
tools.go run 7 months ago

README.md

Redis operator for Kubernetes

Redis operator runs Sentinel and Redis, makes Redis high available with HAProxy.

Build sources

Prebuilt images

You can find images here https://hub.docker.com/r/iam21h/redis-operator

Deploy operator

Namespace-scoped installation

kubectl -n operators -f deploy/service_account.yaml
kubectl -n operators -f deploy/role.yaml
kubectl -n operators -f deploy/role_binding.yaml
kubectl -n operators -f deploy/operator.yaml

Edit operator.yaml to set WATCH_NAMESPACE, may be you want set it to namespace of pod:

env:
  - name: WATCH_NAMESPACE
    valueFrom:
      fieldRef:
        fieldPath: metadata.namespace

Cluster-scoped installation

kubectl -f deploy/clusterrole.yaml
kubectl -f deploy/clusterrole_binding.yaml
kubectl -n operators -f deploy/service_account.yaml
kubectl -n operators -f deploy/operator.yaml

Edit clusterrole_binding.yaml, set namespace for service account.

Your first Redis deployment

This resource can help you run your first Redis instance

apiVersion: blindage.org/v1alpha1
kind: Redis
metadata:
  name: my-redis
spec:
  useHAProxy: true
  haproxyReplicas: 1
  sentinelReplicas: 3
  redisReplicas: 3
  quorum: 2
  haproxyTimeoutServer: 30
  haproxyTimeoutClient: 30
  haproxyBackendCheckInterval: 1
  # set size if you want make persistent volume
  persistentVolumeSize: 1Gi
  persistentVolumeClass: "gluster"
  persistentVolumePurge: true
  pdbRedis:
    maxUnavailable: 1
  pdbSentinel:
    minAvailable: 2

Remember rule: pdbSentinel.minAvailable > (sentinelReplicas / 2) > pdbSentinel.maxUnavailable. This made to save quorum.

Open file pkg/apis/blindage/v1alpha1/redis_types.go to know more about options.


Copyright by Vladimir Smagin (21h) 2019
http://blindage.org email: 21h@blindage.org
Project page: https://git.blindage.org/21h/redis-operator