redis-pod-labeler

by hmdmph

Helm chartv1.0.2App 1.0.0

Labelling redis pods as master/slave periodically checking its status

About this chart

Redis-Pod-Labeler

Redis pod labeler is a simple tool that label the pods of redis-ha cluster (with sentinel) with their role. Written in simple python3 script.

  • This is help to determine which pod is master/ slave
  • Useful when exposing redis master/ slave
  • By default it creates a service that expose the redis master

This chart deploys a small pod and create service account with required privileges to run and update the labels of redis pods. Its just a simple tool that can be run on your namespace as same as your redis namespace.

TL;DR

helm install hmdmph/redis-pod-labeler \
     --name redis-labeler \
     --set namespace=redis \
     --set headlessName=my-redis-redis-ha \
     --set companyDomain=mycompany.com \
     --set redisPodSelector.keyValuePair="release=my-redis"  \
     --set verbose.enabled=true

Above will install the redis-pod-labeler in the namespace of redis. It will find the redis-ha announce services using label release=my-redis and the given headless name my-redis-redis-ha then label them with roles with key/value mycompany.com/role=master

Prerequisites / Dependencies

Installing the Chart

To install the chart with the release name you can give a name as you wish redis-labeler

$ helm repo add hmdmph https://hmdmph.github.io/helm-charts
$ helm install hmdmph/redis-pod-labeler \
       --name redis-labeler \
       --set namespace=redis \
       --set headlessName=my-redis-redis-ha \
       --set companyDomain=mycompany.com \
       --set redisPodSelector.keyValuePair="release=my-redis"  \
       --set verbose.enabled=true

This Helm chart deploys redis-pod-labeler on the Kubernetes cluster in a default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Tip List installed redis-labeler release helm list | grep redis-pod-labeler

Tip get history of chart version/ status/ etc... redis-pod-labeler releases helm history redis-labeler

Uninstalling the Chart

To uninstall/delete the redis-labeler Deployment:

$ helm delete redis-labeler

The command removes all the Kubernetes components associated with the chart and deletes the release.

Upgrading an existing Release to a new major version

A major chart version change (like v2.1.0 -> v3.0.0) indicates that there may be incompatible or breaking changes that require manual actions.

##Changelog

1.0.2

  • Improved docker alpine based small image.
  • Fixed a bug when deploying in multiple redis environments.

1.0.0

  • This is the initial version of the redis-pod-labeler chart with the minimal configuration/ settings.

Configuration

The following table lists main configurable most common parameters of the redis-pod-labeler chart and their default values:

ParameterDescriptionDefault
replicaCountnumber of replicas1
namespacenamespace that you want to install redis-pod-labelerredis
labelUpdateFrequencyhow frequent you want to update the redis pods labels (in seconds)60
redisPodSelector.keyValuePairkey=value of to match and get the redis podsrelease=my-redis
headlessNameheadless service name of redis clustermy-redis-redis-ha
exposeMasterService.enabledexpose the redis master as servicetrue
redisPortredis port6379
skipTlsVerify.enabledskip tls verificationfalse
redisClusterNameredis sentinel cluster namemymaster
companyDomaincompany domain to make labelredis.io
serviceAnnotationsservice annotations{}
verbose.enableddetailed output in the logsfalse
------------------------
nameOverrideoverride chart name""
fullnameOverrideoverride chart full name""
------------------------
image.repositoryimage repositoryredmart/redis-pod-labeler
image.tagimage tag1.0.1
image.pullPolicyimage pull policyIfNotPresent
------------------------
resources.limits.cpucpu resource limit100m
resources.limits.memorymemory resource limit100Mi
resources.requests.cpucpu request80m
resources.requests.memorymemory request50Mi
------------------------
nodeSelectornode selector{}
tolerationstolerations[]
affinitypod affinity{}
------------------------

Happy Helm with ♥ at hmdmph

Deploy redis-pod-labeler with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has redis-pod-labeler on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartredis-pod-labeler is pinned at v1.0.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply