-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Details
Describe the solution you'd like:
Add support for having multiple pod-gateways inside a single cluster and allow the end-user, to select for each client application which pod-gateway set as the default gateway for the client application's pods.
Anything else you would like to add:
Implementation
Gateway service name as annotation
At Pod level
In the simpler form, and allowing the application owner - who, in a DevOps way, would be responsible for configuring their own application's deployment - this could be implemented through annotations at pod-level.
The mutating admission wehbook would inject the $gateway
environment variable to client pods' init and sidecar containers.
You can see a draft implementation here.
At Namespace level
Assuming the following:
- the injection should happen transparently (e.g. as part of a policy enforcement) and managed by an administrator which would choose through which gateway should applications' traffic go through
- Namespaces are objects managed by administrators
an annotation that would hint which gateway to use as Kubernetes Service name, could be applied at Namespace-level.
The mutating admission wehbook would inject the $gateway
environment variable to client pods' init and sidecar containers.
Other
Obviously the way the feature could be achieved is not limited to the above proposed approaches.
Additional Information:
The VXLAN CIDR blocks, for each VXLAN static network (one per gateway) might be able to overlap and this shoudn't be a problem.
This is just a screenshot that shows client pods on the left panes, and gateway pods on the right panes.
The top panes represent a tunnel separated from the bottom one.
The client of which the shells on the left, knows from the $gateway
environment variable, from the headless Kubernetes Service
, the pod-gateway pod-network's IP (from which the init container build the Linux bridge FDB rule):
$ kubectl get pods -n client -o=jsonpath='{.items[*].spec.initContainers[*].env[0]}' | jq
{
"name": "gateway",
"value": "pod-gateway-a.gateway-system.svc.cluster.local"
}
{
"name": "gateway",
"value": "pod-gateway-b.gateway-system.svc.cluster.local"
}
pod-gateway-a
and pod-gateway-b
are the Kubernetes Service
object names that have the pod-gateway-a
and pod-gateway-b
deployment with one replica, residing in the gateway-system
Namespace
:
$kubectl get svc -n gateway-system -o wide
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
pod-gateway-a ClusterIP None <none> 4789/UDP 20h app.kubernetes.io/instance=pod-gateway-a,app.kubernetes.io/name=pod-gateway
pod-gateway-b ClusterIP None <none> 4789/UDP 20h app.kubernetes.io/instance=pod-gateway-b,app.kubernetes.io/name=pod-gateway
pod-gateway-webhook ClusterIP 10.96.119.198 <none> 8080/TCP 21h app.kubernetes.io/instance=pod-gateway,app.kubernetes.io/name=pod-gateway-webhook
$ kubectl get ep -n gateway-system
NAME ENDPOINTS AGE
pod-gateway-a 192.168.228.11:4789 20h
pod-gateway-b 192.168.228.14:4789 20h
pod-gateway-webhook 192.168.228.9:8080 21h
$ kubectl get deploy -n gateway-system -o wide
NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
pod-gateway-a 1/1 1 1 20h pod-gateway ghcr.io/k8s-at-home/pod-gateway:v1.6.1 app.kubernetes.io/instance=pod-gateway-a,app.kubernetes.io/name=pod-gateway
pod-gateway-b 1/1 1 1 20h pod-gateway ghcr.io/k8s-at-home/pod-gateway:v1.6.1 app.kubernetes.io/instance=pod-gateway-b,app.kubernetes.io/name=pod-gateway
pod-gateway-webhook 1/1 1 1 21h webhook quay.io/maxgio92/gateway-admission-controller:v3.7.1-alpha-multigateway app.kubernetes.io/instance=pod-gateway,app.kubernetes.io/name=pod-gateway-webhook
As you can see the gateway VXLAN IPs overlap (i.e. 172.16.0.1) but the Linux FDB together with VXLAN capabilities of the device (drivers) manage for dedicated MAC addresses.
More: multiple clients per each gateway and IP management
In the example scenario of the screenshot above, client VXLAN IP addresses have been statically assigned.
DHCP, of which server and client setup already provided by the pod-gateway feature set, can manage them.