ori-edge / k8s_gateway

A CoreDNS plugin to resolve all types of external Kubernetes resources
Apache License 2.0
297 stars 65 forks source link

Run multiple plugins in a single instance of CoreDNS #81

Open dcplaya opened 2 years ago

dcplaya commented 2 years ago

I have 2 independent clusters, each with their own ingress. Both clusters have the same root domain name, but they are seperated by a sub domain.

Is it possible to run 2 plugins, with 2 different zones and a lookup will check (and fallthrough if needed) both clusters? I have the following in my Coredns config file but I only get NXDOMAIN returns from the cluster-1 URLs. The 2nd instance (home context) seems to work with no issues.

 k8s_gateway cluster-1.FQDN.com {
   ttl 30
   kubeconfig /config/kubeconfig cluster-1
   fallthrough
 }
  k8s_gateway FQDN.com {
    ttl 30
    kubeconfig /config/kubeconfig home
    fallthrough
  }
}
networkop commented 2 years ago

AFAIK, this is not possible but you can define multiple zones, e.g. k8s_gateway cluster-1.FQDN.com cluster-2.FQDN.com

dcplaya commented 2 years ago

AFAIK, this is not possible but you can define multiple zones, e.g. k8s_gateway cluster-1.FQDN.com cluster-2.FQDN.com

Both of those theoretical zones have different ingress IPs for all services and are located in different clusters (so different contexts in kubeconfig).

I'll figure some other way out. Its only temporary while I migrate things around anyway.

networkop commented 2 years ago

ah, I see. So at this point, the plugin assumes there's a single source of information, i.e. a single k8s cluster to sync with. However, what I had in the past is this: https://networkop.co.uk/img/d14.png I had an hierarchy of plugins. The top plugin would receive all queries and then would forward them to one of its child plugins, syncing state from different k8s clusters. If this may help, I can try and see if i still have those configs somewhere