Connect Pods from one cluster to a pod in aother cluster without using k8s service

11/25/2019

We have two k8s clusters:

Cluster details:

Cluster 1:
Pod Network: 172.16.1.0/24
Node Network: 172.16.2.0/24

Cluster 2:
Pod Network: 172.16.3.0/24
Node Network: 172.16.4.0/24

All these networks are connectivity to one another.

Suppose we have 3 pods in each clusters

Cluster1-Pod1: IP: 172.16.1.1 
Cluster1-Pod2: IP: 172.16.1.2
Cluster1-Pod3: IP: 172.16.1.3

Cluster2-Pod1: IP: 172.16.3.1 
Cluster2-Pod2: IP: 172.16.3.2
Cluster2-Pod3: IP: 172.16.3.3

How can one access the apps of pods in cluster2 from cluster1 without creating a k8s service using Pod IP or hostname. Any solution available to publish/advertise pods IP/hostname from one cluster to another? If creating a service is mandatory, any options to achieve it without Type: LoadBlanacer or Ingress?

Appreciate any inputs.

-- user3133062
google-kubernetes-engine
kubernetes
kubernetes-pod
pivotal-cloud-foundry

1 Answer

11/25/2019

Are you sure you are not confusing nodes with clusters? Because if these pods exist on different nodes, within the same cluster, then you can simply access the pod with its IP.

Otherwise, it is not possible to connect to your pod outside the cluster without making your pod public by a service(NodePort, LoadBalancer) or Ingress.

-- Muhammad Abdul Raheem
Source: StackOverflow