pod-gateway

by samipsolutions-charts

Helm chartv9.11.1App latestVerified publisher

Admision controller to change the default gateway and DNS server of PODs. It is typically used to route PODs through a VPN server.

About this chart

pod-gateway

Admision controller to change the default gateway and DNS server of PODs

Source Code

Requirements

Kubernetes: >=1.19.0-0

RepositoryNameVersion
https://bjw-s.github.io/helm-chartscommon1.3.2

Values

KeyTypeDefaultDescription
DNSstring"172.16.0.1"IP address of the DNS server within the vxlan tunnel. All mutated PODs will get this as their DNS server. It must match VXLAN_GATEWAY_IP in settings.sh
DNSPolicystring"None"The DNSPolicy to apply to the POD. Only when set to "None" will the DNS value above apply. To avoid altering POD DNS (i.e., to allow initContainers to use DNS before the the VXLAN is up), set to "ClusterFirst"
addons.vpn.enabledboolfalseEnable the VPN if you want to route through a VPN. You might also want to set VPN_BLOCK_OTHER_TRAFFIC to true for extra safeness in case the VPN does connect
addons.vpn.networkPolicy.egress[0].ports[0].portint1194
addons.vpn.networkPolicy.egress[0].ports[0].protocolstring"UDP"
addons.vpn.networkPolicy.egress[0].to[0].ipBlock.cidrstring"0.0.0.0/0"
addons.vpn.networkPolicy.egress[1].to[0].ipBlock.cidrstring"10.0.0.0/8"
addons.vpn.networkPolicy.enabledbooltrue
addons.vpn.typestring"openvpn"
clusterNamestring"cluster.local"cluster name used to derive the gateway full name
image.pullPolicystring"IfNotPresent"image pull policy of the gateway and inserted helper cotainers
image.repositorystring"ghcr.io/angelnu/pod-gateway"image repository of the gateway and inserted helper containers
image.tagstringchart.appVersionimage tag of the gateway and inserted helper containers
publicPortsstringnilsettings to expose ports, usually through a VPN provider. NOTE: if you change it you will need to manually restart the gateway POD
routed_namespaceslist[]Namespaces that might contain routed PODs and therefore require a copy of the gneerated settings configmap.
settings.DNS_LOCAL_CIDRSstring"local"DNS queries to these domains will be resolved by K8S DNS instead of the default (typcally the VPN client changes it)
settings.NOT_ROUTED_TO_GATEWAY_CIDRSstring""IPs not sent to the POD gateway but to the default K8S. Multiple CIDRs can be specified using blanks as separator. Example for Calico: ""172.22.0.0/16 172.24.0.0/16" This is needed, for example, in case your CNI does not add a non-default rule for the K8S addresses (Flannel does).
settings.VPN_BLOCK_OTHER_TRAFFICboolfalsePrevent non VPN traffic to leave the gateway
settings.VPN_INTERFACEstring"tun0"If using a VPN, interface name created by it
settings.VPN_LOCAL_CIDRSstring"10.0.0.0/8 192.168.0.0/16"Traffic to these IPs will be send through the K8S gateway
settings.VPN_TRAFFIC_PORTint1194If VPN_BLOCK_OTHER_TRAFFIC is true, allow VPN traffic over this port
settings.VXLAN_GATEWAY_FIRST_DYNAMIC_IPint20Keep a range of IPs for static assignment in nat.conf
settings.VXLAN_IDint42Vxlan ID to use
settings.VXLAN_IP_NETWORKstring"172.16.0"VXLAN needs an /24 IP range not conflicting with K8S and local IP ranges
webhookobjectSee belowThe webhook is used to mutate the PODs matching the given namespace labels. It inserts an init and sidecard helper containers that connect to the gateway pod created by this chart.
webhook.gatewayAnnotationstring"setGateway"annotation name to check when evaluating POD. If true the POD will get the gateway. If not set setGatewayDefault will apply.
webhook.gatewayDefaultbooltruedefault behviour for new PODs in the evaluated namespace
webhook.gatewayLabelstring"setGateway"label name to check when evaluating POD. If true the POD will get the gateway. If not set setGatewayDefault will apply.
webhook.image.pullPolicystring"IfNotPresent"image pullPolicy of the webhook
webhook.image.repositorystring"ghcr.io/k8s-at-home/gateway-admision-controller"image repository of the webhook
webhook.image.tagstring"v3.6.0"image tag of the webhook
webhook.namespaceSelectorobject{"custom":{},"label":"routed-gateway","type":"label"}Selector for namespace. All pods in this namespace will get evaluated by the webhook. IMPORTANT: Do not select the namespace where the webhook is deployed to or you will get locking issues.
webhook.replicasint1number of webhook instances to deploy
webhook.strategyobject{"type":"RollingUpdate"}strategy for updates

Deploy pod-gateway with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has pod-gateway 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 chartpod-gateway is pinned at v9.11.1 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