This topic explains how to configure Cloud Native Runtimes for Tanzu to develop locally on kind. Developing locally on kind allows you to visit URLs generated by Knative for your services in a browser, or use curl to view URLs.
Before you follow the procedures below, you must have access to:
Because this feature uses the CoreDNS container image hosted on Docker Hub, you need internet access to pull the image.
To develop locally with Cloud Native Runtimes on kind, you need to create a cluster with ports mapped from your host machine to your kind cluster.
To create a cluster and map ports from your host machine to your kind cluster:
Create and save a file named
kind-cluster.yaml that contains following code:
kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - role: worker extraPortMappings: - containerPort: 31443 # expose port 31443 of the node to port 80 on the host for use later by Contour ingress (envoy) hostPort: 443 - containerPort: 31080 # expose port 31080 of the node to port 80 on the host for use later by Contour ingress (envoy) hostPort: 80 - containerPort: 30053 # expose CoreDNS port to port 53 on the host machine hostPort: 53 protocol: udp - containerPort: 30053 # expose CoreDNS port to port 53 on the host machine hostPort: 53 protocol: tcp
Create a kind cluster. Run:
kind create cluster --config kind-cluster.yaml
After you create a local cluster with kind, you can install Cloud Native Runtimes on that cluster with a flag to enable local DNS. The install script and flag adds a CoreDNS deployment in the
Ensure that your Kubernetes client targets your local kind cluster. Run:
If your Kubernetes client targets your local cluster, the return includes your local cluster information.
cloud-native-runtimes directory, run the installation script:
cnr_provider=local cnr_local_dns__enable=true ./bin/install.sh
Note: Knative Serving routes use
example.comas the default domain. See Setting up a custom domain in the Knative documentation. If you want to use the Local DNS feature with your custom domain, specify your custom domain in the install command: for example,
cnr_provider=local cnr_local_dns__enable=true cnr_local_dns__domain=mydomain.com.
You can verify that your CoreDNS is configured correctly using Dig. For information about using Dig DNS lookup, see Dig in the Google Admin Toolbox.
To use Dig to verify your CoreDNS:
dig test.YOUR-DOMAIN @127.0.0.1
YOUR-DOMAIN is the name of your domain.
If your CoreDNS is configured correctly, the return includes the IPv4 loopback address
To use your CoreDNS to resolve queries, set your host machine to use the IPv4 loopback address
127.0.0.1 as the DNS server.
If you are using DHCP, disconnecting and reconnecting your network connection resets your nameserver.
If your local cluster is deleted, your normal DNS queries continue working because you have other DNS servers configured.
To set the host machine DNS on MacOS:
Create a directory called
/etc/resolver, if the directory does not already exist.
Inside this directory, create a file with the same name as your domain. If you are using the default domain, the filename is
Populate the file with the following nameserver to let your machine know to send any requests for your domain to localhost:
To set the host machine DNS on Linux:
Add the following line to the top of your
The nameserver entries are an ordered list, so anything not served by localhost continues down the file to try other entries.
127.0.0.1as your primary DNS server can break
nslookupon Linux, because it uses only the primary DNS server.
To set the host machine DNS on Windows:
Complete the steps under Change your DNS servers settings, and enter the IPv4 loopback address
127.0.0.1 as the preferred DNS server. See Change your DNS servers settings in the Google Public DNS documentation.
(Optional) Input another preferred DNS server as the alternate DNS server.
(Optional) You may need to disable IPv6 for the resolution to be successful.
127.0.0.1as your primary DNS server can break
nslookupon Windows, because it uses only the primary DNS server.
You can reset the host machine DNS to another IPv4 loopback address using the procedure for your operating system below.
To reset the host machine DNS on MacOS:
To reset the host machine DNS on Linux:
Remove the following line from the top of your
To reset the host machine DNS on Windows:
Complete the steps under Change your DNS servers settings, and enter the IPv4 loopback address as your original preferred DNS server address. See Change your DNS servers settings in the Google Public DNS documentation.
(Optional) Enable IPv6 if you disabled it when you set the host machine DNS.