mongo-pod-labeler

by hmdmph

Helm chartv1.0.2App 1.0.0

Labelling mongo pods (as primary or secondary ) periodically checking its status

About this chart

Mongo-Pod-Labeler

Mongo pod labeler is a simple tool that label the pods of mongo cluster with their role. Written in simple python3 script.

  • This is help to determine which pod is primary/ secondary
  • Useful when exposing mongo primary/ secondary via nodeport( so in your service you can have these labels as selector)

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

TL;DR

$ helm install hmdmph/mongo-pod-labeler

Prerequisites

  • Kubernetes 1.8+ with Beta APIs enabled
  • Deployed mongo cluster

Installing the Chart

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

$ helm repo add hmdmph https://hmdmph.github.io/helm-charts
$ helm install --name mongo-labeler hmdmph/mongo-pod-labeler

This Helm chart deploys mongo-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 mongo-labeler release helm list | grep mongo-pod-labeler

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

Uninstalling the Chart

To uninstall/delete the mongo-labeler Deployment:

$ helm delete mongo-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

  • use latest Kubernetes spec for deployment

1.0.1

  • Improved alpine based small image
  • clear logs in verbose mode

0.1.0

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

Configuration

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

ParameterDescriptionDefault
replicaCountnumber of replicas1
namespacenamespace that you want to install mongo-pod-labelermongo
labelUpdateFrequencyhow frequent you want to update the mongo pods labels (in seconds)60
mongoPodSelector.keyValuePairkey=value of to match and get the mongo podsapp=mongodb-replicaset
verbose.enableddetailed output in the logsfalse
nameOverrideoverride chart name""
fullnameOverrideoverride chart full name""
image.repositoryimage repositoryhmdmph/mongo-pod-labeler
image.tagimage tag1.0.1-alpine
image.pullPolicyimage pull policyIfNotPresent
resources.limits.cpucpu resource limit200m
resources.limits.memorymemory resource limit200Mi
resources.requests.cpucpu request100m
resources.requests.memorymemory request128Mi
nodeSelectornode selector{}
tolerationstolerations[]
affinitypod affinity{}
imagePullSecretsimage pull secrets[]
podAnnotationspod annotations{}
podSecurityContextpod securityContext{}
autoscaling.enabledenable auto pods auto scalefalse
autoscaling.minReplicasminimum replica count1
autoscaling.maxReplicasmaximum replica count2
autoscaling.targetCPUUtilizationPercentageauto scale cpu threshold85
autoscaling.targetMemoryUtilizationPercentageauto scale memory threshold85

Happy Helm with ♥ at hmdmph

Deploy mongo-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 mongo-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 chartmongo-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