mongo-pod-labeler
by hmdmph
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:
| Parameter | Description | Default |
|---|---|---|
replicaCount | number of replicas | 1 |
namespace | namespace that you want to install mongo-pod-labeler | mongo |
labelUpdateFrequency | how frequent you want to update the mongo pods labels (in seconds) | 60 |
mongoPodSelector.keyValuePair | key=value of to match and get the mongo pods | app=mongodb-replicaset |
verbose.enabled | detailed output in the logs | false |
nameOverride | override chart name | "" |
fullnameOverride | override chart full name | "" |
image.repository | image repository | hmdmph/mongo-pod-labeler |
image.tag | image tag | 1.0.1-alpine |
image.pullPolicy | image pull policy | IfNotPresent |
resources.limits.cpu | cpu resource limit | 200m |
resources.limits.memory | memory resource limit | 200Mi |
resources.requests.cpu | cpu request | 100m |
resources.requests.memory | memory request | 128Mi |
nodeSelector | node selector | {} |
tolerations | tolerations | [] |
affinity | pod affinity | {} |
imagePullSecrets | image pull secrets | [] |
podAnnotations | pod annotations | {} |
podSecurityContext | pod securityContext | {} |
autoscaling.enabled | enable auto pods auto scale | false |
autoscaling.minReplicas | minimum replica count | 1 |
autoscaling.maxReplicas | maximum replica count | 2 |
autoscaling.targetCPUUtilizationPercentage | auto scale cpu threshold | 85 |
autoscaling.targetMemoryUtilizationPercentage | auto scale memory threshold | 85 |
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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartmongo-pod-labeler is pinned at v1.0.2 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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