routr-connect

by Fonoster

Helm chartv0.5.4App 3.1.2

Routr Connect Helm Chart

About this chart

Routr Connect

Routr Connect is a lightweight sip proxy, location server, and registrar that provides a reliable and scalable SIP infrastructure for telephony carriers, communication service providers, and integrators.

Website: https://routr.io

TL;DR;

$ helm repo add routr https://routr.io/charts
$ helm repo update
$ helm install routr routr/routr-connect

Note: routr is your release name.

Introduction

This chart bootstraps an Routr Connect deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes v1.25.4+
  • Helm v3.11.1
  • PV provisioner support in the underlying infrastructure

Add this Helm repository to your Helm client

helm repo add routr https://routr.io/charts

Installing the Chart

To install the chart with the release name my-release:

$ kubectl create namespace routr
$ helm install my-release routr/routr-connect --namespace routr

The command deploys Routr Server in the routr namespace on the Kubernetes cluster in the default configuration.

We recommend using a namespace for easy upgrades.

The configuration section lists the parameters that can be configured during installation.

Upgrading the Chart

Scale-out defaults (breaking)

Connect, the Data API and Location now run 2 replicas each (the Dispatcher too, when on), with CPU and memory requests, a spread over the nodes and a PodDisruptionBudget. Their gRPC clients dial new headless Services (<release>-routr-<component>-headless) and balance round robin over every pod. The HorizontalPodAutoscalers are off unless <component>.autoscaling.enabled is true. The EdgePorts get a required pod anti-affinity: at most one per node, so edgeport.replicas must not exceed the nodes that can run them; on a single-node cluster set it to 1. A Location on the memory cache must set location.replicas: 1. To keep the old shape, set replicas: 1, resources.requests: {} and autoscaling.enabled: true per component.

The EdgePorts' dialog table in Redis

The EdgePorts now keep the dialogs they proxied in Redis, like the Location keeps its bindings, so a call set up before a rolling update can still be hung up. Nothing to set with the chart's Redis. With redis.enabled: false each pod keeps its dialogs to itself, as before, unless you set edgeport.cache.parameters to your Redis.

From 0.4.7 or earlier

The EdgePort StatefulSet now uses the <release>-routr-edgeport-headless Service as its governing Service. Kubernetes doesn't allow changing that field on an existing StatefulSet, so delete the StatefulSet first, leaving its pods running, and then upgrade:

$ kubectl delete statefulset my-release-routr-edgeport --cascade=orphan --namespace routr
$ helm upgrade my-release routr/routr-connect --namespace routr

The pods keep serving traffic until the upgraded StatefulSet replaces them.

From 0.4.x (Routr 2) to 0.5 (Routr 3)

Routr 3 runs on the same database and the same image names, with no migration. Every image is now the Go component, which takes its settings from a config file the chart mounts from your values. Secrets stay in the same Kubernetes Secrets; the config files name them with secret://k8s/<secret>#<key> references, mounted at /var/run/routr/secrets/<secret>.

Check these before upgrading:

ValueChange
global.logsLevelTakes debug, info, warn or error. Routr 2's verbose and silly make the chart fail: use debug
connect.trustedRegistryAddressesNew, default the Requester's headless Service, which covers exactly its pods. See Trunk registration
edgeport.podCIDRNew, off by default. For user agents inside the cluster: set it to the pod network (10.244.0.0/16) and each EdgePort's localnet becomes ${POD_IP}/<prefix>, so it reaches pods without externalAddrs. Leave it off when phones outside the cluster use private addresses in that range (Calico's default pool 192.168.0.0/16 is most home routers' range): they would look local and get the pod IP in their Record-Route
connect.trustedEdgePortAddressesNew, default the EdgePorts' headless Service, which covers exactly the release's EdgePorts, so a call that crosses two of them completes
requester.autoscaling.enabledNew, default false: the Requester's HorizontalPodAutoscaler, rendered always before, is opt-in like the other components'; requester.replicas (default 1) sets the pods
rtprelay.autoscaling.enabledNew, default false: the RTPRelay's HorizontalPodAutoscaler, rendered always before while rtprelay.enabled is true, is opt-in like the other components'; rtprelay.replicas (default 1) sets the pods
connect.trustedEdgePorts, connect.nonceMaxAge, connect.registerDefaultExpires, connect.verifierAddr, connect.untrustedHeadersToStripNew: the settings Routr 2's Connect took from its environment
registry.enabledNew, default true. false also leaves out the Requester
apiserver.migrations.image.tagFollows appVersion: the image is Routr 3's, built from ops/pgdata-migrations with Routr 2's migrations unchanged, so a Routr 2 database finds nothing to apply. A tag you set still wins
apiserver.tlsOnRead again, default true: the Data API serves TLS on 51907, and the Service's external port 51908 reaches the same listener. The liveness probe becomes a TCP check, since a Kubernetes gRPC probe can't speak TLS. See Securing the Data API
apiserver.verifyClientCertRead again, default false. It now means a client certificate is one way in, next to the API key, not the only one. Needs tlsSecret: the generated CA keeps no key, so no client certificate can be issued against it
apiserver.tlsSecretNew: a Secret with tls.crt, tls.key and ca.crt. Empty, the default, generates a CA and a certificate once
apiserver.apiKeyNew: the API key of the Data API and the Requester. Empty, the default, generates one once into <release>-routr-api-key
apiserver.apiKeySecretNew: an existing Secret holding the API key under the key apiKey, instead of apiKey or the generated one
networkPolicy.enabledNew, default true. On a CNI that enforces NetworkPolicy, an EdgePort, Dispatcher or processor outside the release that dials the internal services loses access: list it in networkPolicy.ingressFrom
edgeport.heplifyOptionsRemoved: the Go EdgePort image doesn't ship heplify
postgresql.auth.databaseNew, default routr. Only applies to a new database
rtprelay.rtpeHostNow required when rtprelay.enabled is true

Labels and annotations are quoted, so a release named n, on or 123 renders; the Bitnami PostgreSQL and Redis subcharts still write the name unquoted, so the chart refuses such a name unless postgresql.enabled and redis.enabled are false.

The Secret <release>-routr-edgeport-config became a ConfigMap of the same name, now that it holds no password. The log4j2 ConfigMaps are gone. The Requester's and the Registry's probes follow the components: the Requester answers gRPC health on 51909.

Where your user agents run

User agents that run inside the cluster need edgeport.podCIDR; phones and carriers outside it need edgeport.externalAddrs. A user agent inside the cluster is reached at its pod IP only when the EdgePort counts the pod network as local; without podCIDR, the EdgePort's localnet on Calico or Cilium is its own /32 and the call fails with unable to find a valid interface. A phone outside the cluster must get an address it can reach in Via and Record-Route, which is externalAddrs. When both kinds of client use the same private range (Calico's default pool, 192.168.0.0/16, is what most home routers hand out), prefer externalAddrs alone, or move the pod pool.

Securing the Data API

The Data API returns decrypted credentials and takes writes, and the Requester sends arbitrary SIP, so both refuse to start without authentication. The chart keeps one API key in the Secret <release>-routr-api-key and gives it to the Data API, the Requester, Connect and the Registry. A new install or an upgrade generates it once. Rotating it means setting apiserver.apiKey, which rolls those pods; a call between them may fail until they all restart. The pods carry a hash of a key set in values, so it must be random (the chart generates 48 random characters), or use apiserver.apiKeySecret.

To keep the key in a Secret of your own, set apiserver.apiKeySecret to its name; it holds the key under apiKey. The chart neither reads nor writes it: the pods mount it. Rotating it means editing that Secret and then restarting the apiserver, requester, connect and registry Deployments, which read the key at start. The generated Secret is kept (helm.sh/resource-policy: keep), so you can move back to it by unsetting the value.

With apiserver.tlsOn, the default, the Data API's certificate comes from apiserver.tlsSecret or a CA the chart generates once, valid for ten years, in <release>-routr-apiserver-tls. It names the Service and localhost, for kubectl port-forward. The Requester takes the key over plaintext inside the cluster (requesterAuth.insecure: true); no Service publishes it outside. With networkPolicy.enabled, the default, a NetworkPolicy admits only the release's pods to it and to Location, Connect, the Dispatcher and the RTPRelay, which authenticate nobody. It protects only on a CNI that enforces NetworkPolicy.

The Helm lookup that keeps generated values needs access to the cluster. Something that renders the chart without it, such as a GitOps controller or helm template, gets a new key and certificate each time: set apiserver.apiKeySecret or apiserver.apiKey, and apiserver.tlsSecret.

rctl and the SDK reach the Data API with the key and the CA, as the install's notes show. Anything else you wrote against 51907 must now send authorization: Bearer <key> and speak TLS.

Trunk registration

The Registry's REGISTER carries a Trunk's credentials in X-Gateway-Auth, and Connect honors that header only from connect.trustedRegistryAddresses. The Requester's pods have no fixed IP, so the default is a DNS name: <release>-routr-requester-headless.<namespace>, a headless Service that resolves to exactly those pods. Connect resolves it again every 10 seconds, so a new pod is trusted within that time and its first REGISTER may be challenged; the next round goes through.

If the name stops resolving, Connect keeps its last addresses for 30 seconds and then trusts nothing, logging X-Gateway-Auth from an address not in trustedRegistryAddresses for each REGISTER it refuses.

The list also takes IPs, CIDRs and other names, for a Requester outside the release. An empty list fails the install while registry.enabled is true. A CIDR that covers the pod network is a poor substitute: with externalTrafficPolicy: Cluster, the default, a node can rewrite an outside caller's address into it, and Connect would then relay that caller's REGISTER.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

helm delete my-release --namespace routr

The command removes all the Kubernetes components but PVC's associated with the chart and deletes the release.

To delete the PVC's associated with my-release:

kubectl delete pvc -l app.kubernetes.io/instance=my-release --namespace routr

Note: Deleting the PVC's will delete postgresql data as well. Please be cautious before doing it.

The generated API-key Secret, my-release-routr-api-key, also stays after helm delete: it carries helm.sh/resource-policy: keep, so a reinstall under the same name finds the same key. Delete it by hand to start over:

kubectl delete secret my-release-routr-api-key --namespace routr

Changelog

The CHANGELOG provides notable changes on the chart.

Parameters

Global parameters

ParameterDescriptionValue
global.regionRegion for the cluster (reserved for future use)default
global.logsLevellogLevel of every component: debug, info, warn or errorinfo
global.otlpEndpointOTLP/HTTP endpoint for traces, metrics and logs, written as telemetry.otlpEndpoint in every component's file; unset turns it off

NetworkPolicy parameters

ParameterDescriptionValue
networkPolicy.enabledOne NetworkPolicy per internal gRPC service (location, connect, dispatcher, requester, rtprelay): only this release's pods, plus ingressFrom, reach them. The Data API gets none: it authenticates callers. On a CNI that doesn't enforce NetworkPolicy these objects do nothingtrue
networkPolicy.ingressFromExtra peers admitted to the internal services, as NetworkPolicy from entries: an EdgePort, a Dispatcher or a processor outside this release (another release of this chart named in dispatcher.processors[].servicePrefix included), e.g. [{namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: sip-edge}}}][]

Edgeport parameters

| Parameter | Description | Value | | --------------------------------------------------- | -------------------

Deploy routr-connect with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has routr-connect 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 chartroutr-connect is pinned at v0.5.4 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