Relates to How to call a service exposed by a Kubernetes cluster from another Kubernetes cluster in same project.
Asking again since Kubernetes has been changes a lot since July.
Context:
I'm working on an infrastructure with multiple clusters serving different purposes, e.g.:
- Cluster A runs services/apps creating data for consumption
- Cluster B runs services/apps consuming data created by apps in cluster A
- Cluster C runs data services like Redis, Memcache, etc.
All clusters are in the default
namespace.
Problem:
In Kubernetes, each cluster gets its own kubernetes (in the default
namespace) and kube-dns (in the kube-system
namespace) service with a different IP.
What happens with this setup is that, services in cluster A and B above can't discover (in service discovery terminology), let's say, Redis in cluster C. So a nslookup redis.default.svc.cluster.local
from one of the services in cluster A/B comes back with ** server can't find redis.default.svc.cluster.local: NXDOMAIN
. Note: This works from within cluster C.
I've read as many documents as I found about kube-dns, and pretty much all assume one cluster setup.
Clusters info:
Here are /etc/resolv.conf
from two different clusters showing DNS nameservers with no common kube-dns ancestor:
Cluster A:
nameserver 10.67.240.10
nameserver 169.254.169.254
nameserver 10.240.0.1
search default.svc.cluster.local svc.cluster.local cluster.local c.project-name.internal. 1025230764914.google.internal. google.internal.
Cluster C:
nameserver 10.91.240.10
nameserver 169.254.169.254
nameserver 10.240.0.1
search default.svc.cluster.local svc.cluster.local cluster.local c.project-name.internal. google.internal.
options ndots:5
Both clusters have these services running with their respective IPs for their cluster in the kube-system
namespace:
NAME LABELS SELECTOR
kube-dns k8s-app=kube-dns,kubernetes.io/cluster-service=true,kubernetes.io/name=KubeDNS k8s-app=kube-dns
kube-ui k8s-app=kube-ui,kubernetes.io/cluster-service=true,kubernetes.io/name=KubeUI k8s-app=kube-ui
monitoring-heapster kubernetes.io/cluster-service=true,kubernetes.io/name=Heapster k8s-app=heapster
What is the ideal fix/update to this setup that can get the shared services discovered across all Kubernetes clusters in a GCE environment?