In this post, i would like share on how to setup twemproxy for redis cluster sharding running in kubernetes.
Setup
These are the tasks required:
Running twemproxy as a single replica deployment in kubernetes.
Running redis replicas as statefulsets with with in kubernetes.
Allowing other pods in kubernetes to access twemproxy.
Allowing twemproxy to connect to the redis’s pods.
Twemproxy
We can run twemproxy as a single deployment in kubernetes. We can use the following community image jgoodall/twemproxy
twemproxy’s deployment & service spec:
The configuration above will deploy twemproxy’s deployment and service. service in kubernetes allow pods to network with each other, this service will allow other pods to reach twemproxy.
twemproxy.yml:
Above is twemproxy’s configuration which need to be mount as configmap volume in twemproxy’s deployment.
Redis Statefulset
Next, we need to create redis’s statefulset. Statefulset with 3 replicas will create the following pods redis-0, redis-1 and redis-2. Pods created by statefulset will be labeled as statefulset.kubernetes.io/pod-name: , we can use this as selector for the service. Unfortunably, we will still need to create 3 services to allow each pod to be addressable by twemproxy,
At work, while managing a fleet of elasticsearch clusters, we have several linux boxes that have inconsistent number of block devices attached. So to simplif...
OpenVPN is a full-featured open source Secure Socket Layer (SSL) VPN solution. While trying to secure amazon elasticsearch service, we decided that an OpenVP...