Docker image for find and label the redis pods in the kubernetes cluster according to the role ( master, slave)
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.
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 |
An example of a deployment can be found in the file sample-redis-pod-labeler-deployment.yaml