Resolve DNS
This feature is only available for the following:
Running the control plane as a container and the following worker node types:This feature is an Enterprise feature. See our pricing plans or contact our sales team for more information.
This feature enables adding custom DNS rules to the virtual cluster to allow communication with services deployed in the host cluster and across services in separate vCluster instances.
Examplesβ
Enable embedded CoreDNS to ensure DNS resolution works inside the vcluster. Without this setting, DNS queries inside the vcluster, such as resolving services or external domains, fail. Ensure the following is added to vcluster.yaml or Helm values file:
embedded:
  coredns:
    enabled: true
Map a hostnameβ
This is a URL-based mapping of one virtual cluster hostname to another hostname. A wikipedia.com DNS lookup would return a DNS response with answer as en.wikipedia.org.
controlplane:
  coredns:
    enabled: true
    embedded: true 
networking:
  resolveDNS:
    - hostname: wikipedia.com
      target:
        hostname: en.wikipedia.org
Map a hostname wildcardβ
This is a URL-based mapping of one virtual cluster hostname to another hostname. A test.svc.kubernetes DNS lookup would return a DNS response with answer as test.svc.cluster.local.
controlplane:
  coredns:
    enabled: true
    embedded: true 
networking:
  resolveDNS:
    - hostname: *.svc.kubernetes
      target:
        hostname: *.svc.cluster.local
Map a virtual cluster service to a host cluster serviceβ
This example maps the virtual cluster's my-namespace/my-svc resource to the host cluster's dns-test/nginx-svc resource. The DNS response is the nginx-svc IP in the host's dns-test namespace.
controlplane:
  coredns:
    enabled: true
    embedded: true 
networking:
  resolveDNS:
    - service: my-namespace/my-svc
      target:
        hostService: dns-test/nginx-svc
Map services across vCluster instancesβ
This example maps a virtual cluster Service to another Service in a separate virtual cluster.
my-ns-in-vcluster/my-svc-vcluster maps to  dns-test-in-vcluster-ns/test-in-vcluster-service in a vCluster instance named test-cluster deployed in the host namespace test-vcluster-ns.
controlplane:
  coredns:
    enabled: true
    embedded: true 
networking:
  resolveDNS:
    - service: my-ns-in-vcluster/my-svc-vcluster
      target:
        vClusterService: test-vcluster-ns/test-vcluster/dns-test-in-vcluster-ns/test-in-vcluster-service
Map namespacesβ
Map all services under a virtual cluster namespace to a host namespace. This host namespace could also contain another vCluster instance, thereby mapping all vCluster services to another vCluster instance.
controlplane:
  coredns:
    enabled: true
    embedded: true 
networking:
  resolveDNS:
    - namespace: test-in-vcluster-ns
      target:
        hostNamespace: external-vc-ns
All services in the test-vcluster virtual cluster's target namespace test-in-vcluster-ns  map to namespace external-vc-ns.
    ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
    βnginx.external-vc-ns  ββnginx.test-in-vcluster-ns     β
    βsvcA.external-vc-ns   ββsvcA.test-in-vcluster-ns      β
    βsvcB.external-vc-ns   ββsvcB.test-in-vcluster-ns      β
    β...                   ββ...                           β
    ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Config referenceβ
resolveDNS required object[]  β
ResolveDNS allows to define extra DNS rules. This only works if embedded coredns is configured.
resolveDNS required object[]  βhostname required string  β
Hostname is the hostname within the vCluster that should be resolved from.
hostname required string  βservice required string  β
Service is the virtual cluster service that should be resolved from.
service required string  βnamespace required string  β
Namespace is the virtual cluster namespace that should be resolved from.
namespace required string  βtarget required object  β
Target is the DNS target that should get mapped to
target required object  βhostname required string  β
Hostname to use as a DNS target
hostname required string  βip required string  β
IP to use as a DNS target
ip required string  βhostService required string  β
HostService to target, format is hostNamespace/hostService
hostService required string  βhostNamespace required string  β
HostNamespace to target
hostNamespace required string  βvClusterService required string  β
VClusterService format is hostNamespace/vClusterName/vClusterNamespace/vClusterService
vClusterService required string  β