Skip to content

Checking redis pods and labelling them with master/slave accordingly

License

Notifications You must be signed in to change notification settings

GlobalMaksimum/redis-pod-labeler

 
 

Repository files navigation

redis-pod-labeler

Docker image for find and label the redis pods in the kubernetes cluster according to the role ( master, slave)

Docker Image Link

Description

A simple python script to find the redis pods in Kubernetes for the given labels and label them according to the rule.

redis-cli -h redis-ha.redis -p 26379 sentinel get-master-addr-by-name mymaster - used to get the redis master service details

grep -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' - used to get the IP address filtered

Those pods updated with the labels master, slave accordingly.

Arguments

Argument name Description Default
--redis-cluster-name redis sentinel master-group-name (must required)
--redis-headless-svc-name headless service name of the redis (must required)
--namespace namespace of the redis-ha deployment redis
--svc-selector key=value of to match labels and get the redis announce service app=redis-ha
--redis-sentinel_port redis sentinel port 26379
--update-period How frequent this should update the labels (seconds) 60
--company-domain company domain to make label key (example.com/role) redis.io
--config-file path to kube config file -
--incluster-config load in-cluster kube config True
--insecure-skip-tls-verify skip tls verification False
--verbose enable detailed output in the logs False

Example Deployment

An example of a deployment can be found in the file sample-redis-pod-labeler-deployment.yaml

About

Checking redis pods and labelling them with master/slave accordingly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.2%
  • Dockerfile 2.8%