Multiple DNS Names for a public IP in Azure AKS - azure

I'm trying to setup a K8 ingress to route to multiple services based on the hostname. Like mentioned here.
In Azure, I'm able to map DNS name with Public IP using az-cli like this,
az network public-ip update --ids $PUBLICIPID --dns-name $DNSNAME
However, this command isn't letting me to add multiple DNS entries to the same publicIP.
What will be the right way to achieve this in Azure KS? Preferably using az-cli or some other cli tools.

I dont think you can assign multiple Azure managed DNS names to the same public IP, but you can use Azure DNS or some external DNS provider to have as many CNAME records pointing to the same DNS record as you want to.
az network dns record-set cname set-record --resource-group myresourcegroup --zone-name contoso.com --record-set-name test-cname --cname www.contoso.com
an alternative would be to use external dns to let kubernetes manage it.

Related

Resolve Azure Private DNS zone entry from domain joined VM

We have a virtual machine created in Azure which is using a private VNet configured with custom DNS servers in order to domain join the VM (eg. contoso.com)
Now we have a private DNS zone (eg subdomain.contoso.com) created in Azure which is linked to the same VNet as the VM. However, we are not able to resolve the private DNS entries from within the domain joined VM as I believe, Azure query the Azure private DNS with the IP 168.63.129.16
Is there a way we can forward DNS requests from a VM in Azure VNet using custom DNS servers to Azure private DNS zone linked to the same VNet?
Any help is much appreciated. Thanks.
By using Azure Private DNS, you can resolve domain names in a virtual network without the need to add a custom DNS solution.
By using private DNS zones, you can use your own custom domain names rather than the Azure-provided names available today
Is there a way we can forward DNS requests from a VM in Azure VNet
using custom DNS servers to Azure private DNS zone linked to the same
VNet?
If you have created custom DNS private zone, you can enable Autoregistration feature so that DNS requests from your VM in the VNET will be forwarded to the Azure private DNS zone

How to apply custom domain name to azure kubernetes services (AKS) cluster?

I have a AKS cluster with default FQDN name with the suffix of "cloudapp.azure.com". I want to get a domain and apply it to the cluster but am not sure how to apply custom domain to Kubernetes cluster in azure.
Can anyone help me with the steps to apply custom domain name to AKS cluster?
If I understand you correctly, you've already deployed your application on Kubernetes and want to connect it to your custom domain name.
For this purpose you can use NGINX Ingress Controller.
Below I will briefly describe how you can do it on AKS:
First you need to create an ingress controller and ingress resource. For Azure AKS detailed instructions can be found here: create-an-ingress-controller.
Note: By default, the public IP address acquired by NGINX Ingress is lost
if the controller is deleted. I recommend you to
create static public IP address, because it remains if the ingress controller is deleted.
Next identify the public IP address (EXTERNAL-IP) associated with
your NGINX Ingress service that was created in the previous step.
Now you need to create an A DNS record, to point your domain to the cluster.
Additionally you may
want to provide CNAME record, but is isn't mandatory and depends
on your needs.It is possible to create Azure DNS Zone for your
custom domain and then add appropriate record sets to this zone.
Note: Azure DNS is not the domain registrar, you have to configure the
Azure DNS name servers as the correct name servers for
the domain name with the domain name registrar. For more
information, see Delegate a domain to Azure DNS.
Azure won't provide you the DNS names, but it has a service named as DNS zone, where you can register your custom domain ( that you may have from providers like GoDaddy etc ), the externalIP of the ingress or any other load balancer that you see in the AKS clusters can be mapped to this custom domain name in the DNS zone and this will take the traffic to the respective AKS cluster.
Advantage of DNS zone is that, you can enter multiple alias URLs as well and can make them to take traffic to AKS cluster, like
abc.com is your domain ( let's say )
api.abc.com is for mobile applications to communicate with AKS and this can be pointed to same URL via CNames in DNS zone.
You can have multiple options here based on your usecase, refer Azure's documentation on DNS zones for that

Azure Container Instance - dns and subnet in the same container

I have an Azure Container Instance with subnet configuration (I need to access an internal service). But I also need to configure dns.
I try to create the Container, but it returns this message: The IP address type can not be public when the network profile is set.
Is it possible to configure dns and configure the subnet in the same container?
Unfortunately, if you deploy the Azure Container Instances in the Subnet of a Vnet, then you cannot set the public IPs or DNS for it. Azure does not support it, at least now. Maybe it will be supported in the future. For more details, see Virtual network deployment limitations.
Container groups deployed to a virtual network do not currently
support public IP addresses or DNS name labels.
Hope this will help you.
The error with the network profile looks like a bug in the az
command tool. If you just specify your VNET name and subnet name
then it will create a network profile name.
If you want to use DNS
to resolve these names you'll need to setup DNS separately, and call
an additional az command to configure the DNS after you create the
container instance.
az network dns record-set a add-record ...
See this doc for using Azure DNS with private IP addresses.
Use Azure DNS for private domains

Azure VMSS : Retrieve FQDN

I have created a Virtual machine scale set in Azure and now require to access FQDN of instance from inside of VM. Tried these:
1. Using Azure metadata service. It surprisingly does not have FQDN field.
2. used Hostname -f it gave an fqdn but I think it is to be used internally in azure as it is not accessible from outside.
3. Tried listing public IP of VMSS but how to filter it to show public ip related my VM escapes me.
Update : In AWS "curl http://169.254.169.254/latest/meta-data/public-hostname" commands give the intended output. I am looking for its equivalent
For now, it's not possible to get FQDN from metadata server.
More information about data categories are available through the Instance Metadata Service, please refer to this link.
Does your VMSS instances create with public IP addresses? if yes, you can use Powershell or Azure portal to find the FQDN.

How do I use the default 'Internal Azure DNS' to resolve DNS names of worker roles within the same Azure Virtual Network?

I have a cloud service that has a worker role 'Kernel' with 2 instances (instance 0, and instance 1). I have another VM deployed in a different subnet, in the same Azure Virtual Network. I heard that I can use Azure DNS to resolve a hostname to get the private (dynamic) IP address of each worker role. But how do I actually do that? I assume on the client side this is just a standard DNS lookup, so the question is really: what do I put in the CSCFG file, and what FQDN DNS name is actually what I should resolve?
To set the name on the worker role VMs, add vmName to the cscfg as described here: https://msdn.microsoft.com/en-us/library/azure/jj156212.aspx
The two workers will have a common DNS suffix so you can just refer to them by name. To find the FQDN you'll either need to login to one of the VMs and do ipconfig /all or use the powershell Get-AzureVM cmdlet with the -Debug switch and look for InternalDnsSuffix.
Regards
Gareth [MSFT]

Resources