'How to configure VPN connection between 2 Kubernetes clusters

How to configure VPN connection between 2 Kubernetes clusters.

The case is: - 2 kubernetes clusters running on different sites - OpenVPN connectivity between 2 clusters - In both kubernetes clusters are installed openvpn running in separate container.

How to configure kubernetes clusters (vpn, routing, firewall configurations) so, the Nodes and Containers of any of the kubernetes clusters to have connectivity through VPN to nodes and services to the other cluster?

Thank you for the answers !!!



Solution 1:[1]

You can use Submariner to connect multiple clusters, it creates a secure and performant connection between the clusters on-premises and on public clouds, then you can export the services and access them across all clusters in the cluster set.

enter image description here

Usually we use this tool to create multiple K8S clusters in different geographical locations, then replicate the databases across all the clusters to avoid data loss in case of any data center incident.

Solution 2:[2]

What you need in Kubernetes is called federation.

Deprecated

Use of Federation v1 is strongly discouraged. Federation V1 never achieved GA status and is no longer under active development. Documentation is for historical purposes only.

For more information, see the intended replacement, Kubernetes Federation v2.

As for using a VPN in Kubernetes, I recommend Exposing Kubernetes cluster over VPN. It describes how to connect VPN node to kuberentes cluster or Kubernetes services.

You might be also interested in reading Kubernetes documentation regarding Running in Multiple Zones. Also Kubernetes multi-cluster networking made simple, which explains different use cases of VPNs across number of clusters and is strongly encouraging to use IPv6 instead of IPv4.

Why use IPv6? Because “we could assign a?—?public?—?IPv6 address to EVERY ATOM ON THE SURFACE OF THE EARTH, and still have enough addresses left to do another 100+ earths” [SOURCE]

Lastly Introducing kEdge: a fresh approach to cross-cluster communication, which seems to make live easier and helps with configuration and maintenance of VPN services between clusters.

Solution 3:[3]

Submariner is a very good solution but unfortunately doesn't support IPv6 yet so if your use case has ipv6 or dualstack clusters, then it could be an issue

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hussein Awala
Solution 2 Community
Solution 3 Muhammad Zeeshan Nazir