multi-service-deployment

by Snowplow

Helm chartv0.8.0Verified publisher

A Helm Chart to deploy multiple services with a single release using the common library

About this chart

multi-service-deployment

A helm chart to deploy multiple services in a single Helm release using the common library chart.

TL;DR

helm repo add snowplow-devops https://snowplow-devops.github.io/helm-charts
helm install my-services snowplow-devops/multi-service-deployment

Introduction

This chart allows you to deploy multiple services (1 to N) in a single Helm release, leveraging the common library chart for reusable template components. Each service in the deployment can have its own:

  • Container image and configuration
  • Service bindings and ingress rules
  • Auto-scaling policies (HPA/VPA)
  • Persistent volumes
  • RBAC policies
  • Hooks for lifecycle management
  • Cloud-specific service account bindings

Additionally, the chart supports shared ingress for path-based routing, allowing a single hostname to route different URL paths to different services.

This chart is ideal for deploying microservices that need to be managed together as a cohesive unit, sharing the same release lifecycle.

Use Cases

Multiple Services in One Release

Deploy related microservices (frontend, backend, worker) that should be installed, upgraded, and deleted together:

services:
  - name: frontend
    image:
      repository: my-frontend
      tag: v1.0.0
    service:
      deploy: true
      port: 80
  - name: backend
    image:
      repository: my-backend
      tag: v1.0.0
    service:
      deploy: true
      port: 3000
  - name: worker
    image:
      repository: my-worker
      tag: v1.0.0
    service:
      deploy: false

Single Service (Alternative to service-deployment)

You can also use this chart to deploy a single service by providing an array with one element:

services:
  - name: my-app
    image:
      repository: nginx
      tag: latest
    service:
      deploy: true
      port: 8000

Path-Based Routing with Shared Ingress

Route different URL paths to different services using a single hostname:

services:
  - name: api-crud
    image:
      repository: mycompany/api
      tag: v1.0.0
    service:
      deploy: true
      port: 8000

  - name: api-attributes
    image:
      repository: mycompany/api
      tag: v1.0.0
    service:
      deploy: true
      port: 8000

sharedIngress:
  - name: api-router
    hostname: api.example.com
    certificateIssuer: letsencrypt-prod
    routes:
      - path: /api/v1/attributes
        pathType: Prefix
        serviceName: api-attributes
        port: 8000
      - path: /
        pathType: Prefix
        serviceName: api-crud
        port: 8000

Key Differences from service-deployment Chart

Featureservice-deploymentmulti-service-deployment
Number of services11 to N
Values structureFlat (top-level fields)Array under services[]
NamingUses fullnameOverride or Release.NameUses service name field
TemplatesInline templatesUses common library chart
Dependenciesdockerconfigjson, cloudserviceaccountcommon, dockerconfigjson, cloudserviceaccount

Installing the Chart

Install or upgrading the chart with default configuration:

helm upgrade --install my-services snowplow-devops/multi-service-deployment

Install with custom values:

helm upgrade --install my-services snowplow-devops/multi-service-deployment \
  --values my-values.yaml

Uninstalling the Chart

To uninstall/delete the my-services release:

helm delete my-services

Configuration

Global Configuration

KeyTypeDefaultDescription
global.cloudstring""Cloud provider (options: aws, gcp, azure)
global.labelsobject{}Labels applied to all resources
sharedIngressarray[]Shared ingress definitions for path-based routing
extraObjectsarray[]Extra Kubernetes objects to deploy alongside services

Shared Ingress Configuration

KeyTypeDefaultDescription
sharedIngress[].namestringrequiredName of the ingress resource
sharedIngress[].hostnamestringrequiredHostname for the ingress
sharedIngress[].certificateIssuerstring""cert-manager cluster issuer name
sharedIngress[].tlsSecretNamestring""Override TLS secret name (default: {name}-tls)
sharedIngress[].enableTraefikbooltrueUse Traefik ingress class and annotations
sharedIngress[].ingressClassNamestring""Custom ingress class (when enableTraefik is false)
sharedIngress[].annotationsobject{}Additional annotations for the ingress
sharedIngress[].routesarrayrequiredArray of path-based routing rules
sharedIngress[].routes[].pathstringrequiredURL path to match
sharedIngress[].routes[].pathTypestring"Prefix"Path type: Prefix, Exact, or ImplementationSpecific
sharedIngress[].routes[].serviceNamestringrequiredTarget service name
sharedIngress[].routes[].portintrequiredTarget service port

Service Configuration

Each service in the services array supports all configuration options from the service-deployment chart:

KeyTypeDefaultDescription
services[].namestringrequiredName of the service (used for all resource names)
services[].imageobjectrequiredContainer image configuration
services[].image.repositorystringrequiredContainer image repository
services[].image.tagstringrequiredContainer image tag
services[].image.isRepositoryPublicbooltrueWhether the repository is public
services[].image.pullPolicystring"IfNotPresent"Image pull policy
services[].configobject{}Configuration (command, args, env, secrets)
services[].resourcesobject{}Resource requests and limits
services[].service.deploybooltrueWhether to create a Service
services[].service.portint8000Service port
services[].service.targetPortint80Container target port
services[].service.ingressobject{}Ingress configuration
services[].service.ingressIPAllowlistlist[]List of IPs/CIDRs allowed to reach the service via ingress (Traefik Middleware)
services[].service.rateLimit.enabledboolfalseEnable rate limiting via Traefik Middleware
services[].service.rateLimit.averageint100Average number of requests per period allowed
services[].service.rateLimit.burstint200Maximum number of requests allowed in a burst
services[].service.rateLimit.periodstring"1m"Time period for rate limiting (e.g., "1m", "1s", "1h")
services[].service.rateLimit.sourceCriterion.enabledboolfalseEnable source-based rate limiting (false = global rate limit)
services[].service.rateLimit.sourceCriterion.typestring"ipStrategy"Type of source criterion: "ipStrategy", "requestHeaderName", or "requestHost"
services[].service.rateLimit.sourceCriterion.ipStrategy.depthint1Depth of IP extraction for X-Forwarded-For header
services[].service.rateLimit.sourceCriterion.ipStrategy.excludedIPslist[]List of IPs/CIDRs that bypass rate limiting
services[].service.rateLimit.sourceCriterion.requestHeaderNamestring""Header name to use when type is "requestHeaderName"
services[].hpa.deploybooltrueWhether to deploy HPA
services[].hpa.minReplicasint1Minimum replicas
services[].hpa.maxReplicasint20Maximum replicas
services[].vpa.enabledboolfalseWhether to enable VPA
services[].deployment.kindstring"Deployment"Deployment kind (Deployment or StatefulSet)
services[].deployment.podAnnotationsobject{}Map of annotations that will be added to each pod
services[].deployment.podLabelsobject{}Map of labels that will be added to each pod
services[].deployment.replicasint1Number of replicas (when HPA disabled)
services[].persistentVolume.enabledboolfalseWhether to create PVC
services[].hooksobject{}Helm hooks configuration
services[].rbac.role.deployboolfalseWhether to create Role
services[].rbac.clusterRole.deployboolfalseWhether to create ClusterRole

For a complete list of configuration options, see the values.yaml file.

Examples

Example 1: Frontend and Backend with Ingress

global:
  cloud: aws
  labels:
    environment: production

services:
  - name: frontend
    image:
      repository: mycompany/frontend
      tag: v2.1.0
      isRepositoryPublic: false
    service:
      deploy: true
      port: 80
      targetPort: 8080
      ingress:
        main:
          hostname: example.com
          enableTraefik: true
    hpa:
      deploy: true
      minReplicas: 2
      maxReplicas: 10
    dockerconfigjson:
      name: frontend-dockerhub
      username: myuser
      password: mypassword

  - name: backend
    image:
      repository: mycompany/backend
      tag: v2.1.0
      isRepositoryPublic: false
    config:
      env:
        DATABASE_HOST: postgres.default.svc.cluster.local
      secrets:
        DATABASE_PASSWORD: supersecret
    service:
      deploy: true
      port: 3000
      targetPort: 3000
    hpa:
      deploy: true
      minReplicas: 3
      maxReplicas: 15
    cloudserviceaccount:
      deploy: true
      name: backend-sa
      aws:
        roleARN: arn:aws:iam::123456789012:role/backend-role

Example 2: Microservices with Persistent Storage

services:
  - name: api
    image:
      repository: myapp/api
      tag: latest
    service:
      deploy: true
      port: 8080

  - name: database
    image:
      repository: postgres
      tag: "14"
    config:
      env:
        POSTGRES_DB: mydb
      secrets:
        POSTGRES_PASSWORD: dbpassword
    service:
      deploy: true
      port: 5432
      targetPort: 5432
    deployment:
      kind: StatefulSet
    hpa:
      deploy: false
    deployment:
      replicas: 1
    persistentVolume:
      enabled: true
      size: 20Gi
      mountPath: /var/lib/postgresql/data
      storageClass: fast-ssd

Example 3: Single Service with Hooks

services:
  - name: myapp
    image:
      repository: nginx
      tag: latest
    service:
      deploy: true
      port: 80
    hooks:
      db-migrate:
        enabled: true
        image: myapp/migrations:latest
        hookPhase: pre-install
        hookDeletePolicy: hook-succeeded
        script: |
          echo "Running database migrations..."
          npm run migrate
        env:
          DATABASE_URL: postgres://db:5432/myapp

Notes

  • Each service's name field must be unique within the release
  • Service names are used for all Kubernetes resource names (Deployment, Service, etc.)
  • Global labels are applied to all resources across all services
  • Each service can have its own dockerconfigjson and cloudserviceaccount configuration
  • The chart uses the common library for all template logic, ensuring consistency

Requirements

RepositoryNameVersion
https://snowplow-devops.github.io/helm-chartscommon0.9.0

Deploy multi-service-deployment with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has multi-service-deployment 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 chartmulti-service-deployment is pinned at v0.8.0 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