For every workload created, a complementing Service Discovery entry is created. This Service Discovery entry enables DNS resolution for the workload’s pods using the following naming convention:
However, you also have the option of creating additional Service Discovery records. You can use these additional records so that a given namespace resolves with one or more external IP addresses, an external hostname, an alias to another DNS record, other workloads, or a set of pods that match a selector that you create.
From the Global view, open the project that you want to add a DNS record to.
Select the Service Discovery tab. Then click Add Record.
Enter a Name for the DNS record. This name is used for DNS resolution.
Select a Namespace from the drop-down list. Alternatively, you can create a new namespace on the fly by clicking Add to a new namespace.
Select one of the Resolves To options to route requests to the DNS record.
One or more external IP addresses
Enter an IP address in the Target IP Addresses field. Add more IP addresses by clicking Add Target IP.
An external hostname
Enter a Target Hostname.
Alias of another DNS record’s value
Click Add Target Record and select another DNS record from the Value drop-down.
One or more workloads
Click Add Target Workload and select another workload from the Value drop-down.
The set of pods which match a selector
Enter key value pairs of label selectors to create a record for all pods that match your parameters.
Result: A new DNS record is created.
- You can view the record by from the project’s Service Discovery tab.
- When you visit the new DNS name for the new record that you created (
<recordname>.<namespace>.svc.cluster.local), it resolves the chosen namespace.