
Overview
ExternalDNS service publishes DNS records for applications to DNS servers. This post explains how to deploy ExternalDNS into a Tanzu Kubernetes (workload) and dns zone deployed on Azure.
Pre reqs
- Bootstrap machine with the following installed: Tanzu CLI, kubectl installed as mentioned here
- Tanzu Kubernetes Grid management cluster and workload cluster running on vSphere, Amazon EC2, or Azure, with the package repository installed. For this demo, I have deployed TKG on Azure.
- Registered Domain Name
Note: For this demo, I have used a domain (captainvirtualization.in) registered with Godaddy and created dns zone in Azure as shown below:
Install AZ CLI
- Follow the steps given here to install AZ CLI on your bootstrap machine.
Prepare setup in Azure
- In Azure portal: Navigate to Home > Services > Azure Active Directory > App registrations > + New Registration
- Provide a name and click Register
Note the Application ID, Tenant ID from the registered service principal
- To connect the ExternalDNS service to the Azure DNS service, you create a configuration file named azure.json with content like shown below:
Install the package
In TMC Console: Catalog > select the workload cluster (capv-workload in my case) from drop down and click on external-dns
- Click on Install Package which can be found on top right side of the page
- Name the Installed package as : capv-workload-extdns and click NEXT
- Package install resources: Leave to Default and click NEXT
- Configure values: Provide below values after changing domain-filter and resource-group
- Install Package
Validate
In TMC Console: Clusters > capv-workload > Add-ons > Installed > check if the package ( external-dns.tanzu.vmware.com ) is succeeded and healthy
- Now, lets test the external-dns:
- Create a yaml with below config to create a Service and Deployment
- DNS record should be automatically created as shown below:
- Access the hostname in browser and it should load nginx page as shown below:
This confirms that external-dns is working as expected as the DNS records are created automatically in DNS.