Helm: multiple deployment of the same chart with Chart’s dependency

By | 08/19/2023

To improve the performance of Grafana Loki, it is necessary to install several almost identical instances of Memcached, see Grafana Loki: performance optimization with Recording Rules, caching, and parallel queries.

The monitoring stack itself is deployed from one Helm chart, which dependencies – Promtail, Loki, etc – are added through the dependency field of the Chart.yaml file, see VictoriaMetrics: deploying a Kubernetes monitoring stack.

So, how this can be done without the necessity of installing with separate Helm releases, but deploying together with the monitoring stack, so that Memcached is simply added to the dependencies of the main chart?

As an option, this can be achieved with the Helm alias.

Add a new chart three times – for each instance of Memcached, and for each assign an aliaschunk-cacheresults-cache, and index-cache :

apiVersion: v2
name: atlas-victoriametrics
description: A Helm chart for Atlas Victoria Metrics kubernetes monitoring stack
type: application
version: 0.1.0
appVersion: "1.16.0"
dependencies:
...
- name: prometheus-blackbox-exporter
  version: ~8.2.0
  repository: https://prometheus-community.github.io/helm-charts
- name: memcached
  version: ~6.5.6
  repository: https://charts.bitnami.com/bitnami
  alias: chunk-cache
- name: memcached
  version: ~6.5.6
  repository: https://charts.bitnami.com/bitnami
  alias: results-cache
- name: memcached
  version: ~6.5.6
  repository: https://charts.bitnami.com/bitnami
  alias: index-cache

Update dependencies:

[simterm]

$ helm dependency update

[/simterm]

Deploy and check whether Memcached Services have appeared:

[simterm]

$ kk -n dev-monitoring-ns get svc | grep cache
atlas-victoriametrics-chunk-cache                      ClusterIP   172.20.120.24    <none>        11211/TCP                    15m
atlas-victoriametrics-index-cache                      ClusterIP   172.20.75.206    <none>        11211/TCP                    15m
atlas-victoriametrics-results-cache                    ClusterIP   172.20.212.198   <none>        11211/TCP                    14m

[/simterm]

Done.