Sign inSign up

hmdmph/redis-pod-labeler

By hmdmph

•Updated over 6 years ago

Checking redis pods ( sentinel enabled) and labelling them with master/slave accordingly.

Image
0

2.9K

hmdmph/redis-pod-labeler repository overview

⁠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 nameDescriptionDefault
--redis-cluster-nameredis sentinel master-group-name (must required)
--redis-headless-svc-nameheadless service name of the redis (must required)
--namespacenamespace of the redis-ha deploymentredis
--svc-selectorkey=value of to match labels and get the redis announce serviceapp=redis-ha
--redis-sentinel_portredis sentinel port26379
--update-periodHow frequent this should update the labels (seconds)60
--company-domaincompany domain to make label key (example.com/role)redis.io
--config-filepath to kube config file-
--incluster-configload in-cluster kube configTrue
--insecure-skip-tls-verifyskip tls verificationFalse
--verboseenable detailed output in the logsFalse

⁠Example Deployment

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

Tag summary

Content type

Image

Digest

Size

30.5 MB

Last updated

over 6 years ago

docker pull hmdmph/redis-pod-labeler