Redis Sentinel Deployment Template for OpenShift (Origin)
This project aims to provide a missing template for creating Redis Sentinel cluster in OpenShift Origin. The basic idea is to create a standalone pod with 1 replica to launch a redis master along with a sentinel container in it. Then launch a DeploymentConfig (dc) to create and scale multiple redis slaves. This dc contains a pod with a redis slave container and redis sentinel container.
Before using the template including in this project, you need to make sure the following prerequisites:
- OpenShift Origin server v3.6.0 or above available
- OpenShift cli tool oc must be installed in your host machine
- A private registry or using Docker Hub to maintain your redis sentinel image
Note: you can get OpenShift via installing MiniShift or download OpenShift Origin server from Github into your VM (RHEL or CentOS recommended)
The OpenShift templates and image streams are often been created and maintained within openshift project, which is one of internal projects by OpenShift itself. To import your template, you need to login as system:admin to do that. The sample script would be something as follows:
$ cd openshift-redis-sentinel $ oc login -u system:admin -n openshift $ oc create -f templates/redis-sentinel-template.json
Deploy Your App using Template
- Deploy Redis Sentinel app into your project
$ oc login -u <username> -p <password> -n <your_project> $ oc process openshift//redis-sentinel | oc create -f -
- Get ingress port and test your redis sentinel
# Get redis ingress port $ oc export svc redis-sentinel-ingress | grep 'nodePort' # - nodePort: 31443 # Take minishift as instance $ redis-cli -h $(minishift ip) -p 31443
When deployment is completed, the Redis Sentinel cluster is actually not fully up and running. You need to wait for a short while and attempt to login redis via cli by the ingress port exposed by service redis-sentinel-ingress.
This project is inspired by the following repo or resources. Many thanks to the respected authors.