Advanced usage
The Connectivity Gateway (CGW) chart has dedicated configuration and templates for its built-in components: IPsec, BIRD, VRRP, GRE, the exporters, and PCAP.
Containers in the CGW Deployment's pod share one network namespace, as they do in any Kubernetes pod. An additional container can therefore use the IPsec and BIRD interfaces — including VTI and GRE tunnels — and shares the pod's routing tables, conntrack table, and sockets. This makes the values useful for adding network functions, but also means that ports and network state are shared.
Use the following values to add anything (see Use cases to get inspired) else:
These values provide insertion points for components that the CGW chart does not configure itself. Define the component's image, permissions, volume mounts, and any other prerequisites in the entry and its supporting Kubernetes resources; selecting and fulfilling those requirements is outside the scope of the CGW chart.
Use cases
Observability beyond the shipped exporters:
keepalived_exporterfor the VRRP state, which the chart has no exporter for.blackbox_exporterprobing HTTP, DNS or TCP through a tunnel.- An IPFIX or NetFlow exporter on the VTI and GRE interfaces, feeding a collector outside the cluster.
- A syslog forwarder shipping the strongSwan and BIRD logs to the operator's existing NMS across the VPN.
Services that have to live in the gateway's network namespace to be reachable from the remote site:
- DNS for the remote site, bound to a VTI address, or a stub resolver forwarding over the tunnel.
- A DHCP relay from a GRETAP segment towards a central server across the VPN.
- A TCP or UDP proxy publishing a service that is only reachable through the tunnel into the cluster, or the other way around.
- An SNMP agent or trap forwarder, so the operator can poll the gateway.
- An IGMP proxy or PIM for multicast over GRETAP.
Data path setup the values do not model:
tcshaping, nftables rules orip rulepolicy routing. Usually anadditionalInitContainersentry, since it has to be in place before the tunnels come up.- NAT64 or 464XLAT for an IPv4-only site behind an IPv6 core.
- A second, independent tunnel — a WireGuard management path alongside the IPsec data path, as shown below.
Operations:
- A toolbox container where cluster policy forbids
kubectl debug, if the shipped debug container is not enough. - A configuration puller that syncs Git content to the BIRD configuration
directory, then runs
birdc configure, as the external-source counterpart tobird.birdConfigWatcher. - Route health injection: a probe that withdraws a BIRD route when a downstream check fails.
What the pod already provides
The shared namespace means a shared port space. These ports are taken by the chart and are fixed:
One volume exists in every pod and can be mounted without declaring it:
podshare, anemptyDir, for handing files between containers.
Note
The chart's own containers add capabilities per container rather
than through a pod-wide securityContext, and an additional container has to
do the same. NET_ADMIN is what a container needs to configure a link;
NET_RAW, for raw packets, is in the runtime's default set and does not have
to be added. See Container privileges for what each
of the chart's containers holds.
Example: a WireGuard management tunnel
A WireGuard sidecar gives the gateway a second tunnel, independent of the IPsec data path — useful as an out-of-band management path that stays up while the IPsec configuration is being changed, or to reach a peer that does not speak IKEv2.
Because the interface is created in the pod's namespace, every other container
sees it. BIRD can establish a peering session over wg0, and the routes it
installs apply to the whole pod.
The chart containers and this sidecar start in parallel. If the BIRD
configuration refers to wg0, ensure its protocol retries tolerate the
interface appearing after BIRD starts.
The private key and the peers belong in a Secret, not in the values:
To reach the tunnel from outside the cluster, publish the listen port:
Note
The in-kernel implementation needs the wireguard module to be
available on the node. Load it through the node configuration before the CGW
pod is scheduled; wg-quick does not load it. Where that is not an option,
run a userspace implementation — wireguard-go or boringtun, selected with
WG_QUICK_USERSPACE_IMPLEMENTATION — which needs /dev/net/tun instead.
Example: scraping the WireGuard tunnel
The transfer counters and last handshake per peer can be made available with prometheus_wireguard_exporterOpens in a new tab:
Expose the port through a Service before Prometheus can scrape it:
The CGW chart renders that Service; it does not render a ServiceMonitor for
it. If this gateway is scraped by the ServiceMonitor installed by a
cgw-support release, add the endpoint to the cgw-support chart values for
that release. additionalEndpoints appends it to that ServiceMonitor's shipped
exporter endpoints:
Useful series once it is scraped:
wireguard_latest_handshake_seconds— a peer that stops handshaking is down, even though the interface stays up.wireguard_sent_bytes_total,wireguard_received_bytes_total— per peer throughput.
The endpoint refers to the port name of the Service, so the two names must
match. An endpoint whose port name exists on no selected service produces no
target and no error — if the metrics do not appear, that mismatch is the first
thing to check.
Each metrics port should be scraped by one ServiceMonitor. If an
operator-managed ServiceMonitor owns this Service, add the
wireguard-exporter endpoint there instead of using additionalEndpoints.
If the cgw-support ServiceMonitor shares responsibility with another
ServiceMonitor for the standard CGW exporter ports, set
prometheus.servicemonitor.endpoints in the cgw-support chart values to
only the ports it owns. endpoints replaces the default endpoint list;
additionalEndpoints is appended to it.
Constraints for added components
When adding or changing a component through these values, account for the following constraints:
- Shared port space. Bind to a specific address where a port is ambiguous, and stay off the ports listed above.
- Tunnel interfaces come and go. A VTI is created and removed with its associated SA. A container that configures one at startup is wrong after the first rekey; watch the interface instead of assuming it.
- The firewall does not know about the new port. With
iptables.enabled, add a rule for it toiptables.ipv4Rulesandiptables.ipv6Rules. The chart opens the ports of its own exporters only. - Adding a container restarts the pod. The deployment strategy is
Recreate, and a restart tears down every SA along with the VTI and route setup. Plan the change like a maintenance window, not like a configuration reload. - The pod's QoS class depends on every container. The chart's own
containers state
cpuandmemorylimits only, which Kubernetes also takes as requests, and the pod lands in the QoS classGuaranteed. An added container keeps it there only with both limits set and no lower requests; otherwise the whole pod becomesBurstable. - Nothing validates these values. They are copied into the manifest as
given. A malformed Kubernetes object is rejected by the API server; a
runtime or container-configuration mistake can cause a
CrashLoopBackOff. Check withhelm templatebefore applying.