Skip to content

Commit 898c1ac

Browse files
authored
Update static-ip.md doc to add DNS annotation section
Document the annotation service.beta.kubernetes.io/azure-dns-label-name, to set the Azure PublicIP DNS label
1 parent ee66d5d commit 898c1ac

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

articles/aks/static-ip.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Use a static IP address with the Azure Kubernetes Service (AKS) load balancer
2+
title: Use a static IP address and DNS label with the Azure Kubernetes Service (AKS) load balancer
33
description: Learn how to create and use a static IP address with the Azure Kubernetes Service (AKS) load balancer.
44
services: container-service
55
author: mlearned
@@ -12,7 +12,7 @@ ms.author: mlearned
1212
#Customer intent: As a cluster operator or developer, I want to create and manage static IP address resources in Azure that I can use beyond the lifecycle of an individual Kubernetes service deployed in an AKS cluster.
1313
---
1414

15-
# Use a static public IP address with the Azure Kubernetes Service (AKS) load balancer
15+
# Use a static public IP address and DNS label with the Azure Kubernetes Service (AKS) load balancer
1616

1717
By default, the public IP address assigned to a load balancer resource created by an AKS cluster is only valid for the lifespan of that resource. If you delete the Kubernetes service, the associated load balancer and IP address are also deleted. If you want to assign a specific IP address or retain an IP address for redeployed Kubernetes services, you can create and use a static public IP address.
1818

@@ -96,6 +96,29 @@ Create the service and deployment with the `kubectl apply` command.
9696
kubectl apply -f load-balancer-service.yaml
9797
```
9898

99+
## Appling a DNS label to the service
100+
101+
If your service is using a Dynamic or Static Public IP address, you can use the service annotation `service.beta.kubernetes.io/azure-dns-label-name` to set a public facing DNS label. This will publish a FQDN for your service using Azure's public DNS servers and top level domain. The annotation value Must be unique within the Azure location , so its recommended to use a sufficiently qualified label.
102+
103+
Azure will then automatically append a default subnet such as `<location>.cloudapp.azure.com` (where location is the region you selected) to the name you provide, to create the fully qualified DNS name. For example:
104+
105+
```yaml
106+
apiVersion: v1
107+
kind: Service
108+
metadata:
109+
annotations:
110+
service.beta.kubernetes.io/azure-dns-label-name: myserviceuniquelabel
111+
name: azure-load-balancer
112+
spec:
113+
type: LoadBalancer
114+
ports:
115+
- port: 80
116+
selector:
117+
app: azure-load-balancer
118+
```
119+
120+
NOTE: To publish the service on your own domain, please see [Azure DNS][azure-dns-zone] and the [external-dns][external-dns] project.
121+
99122
## Troubleshoot
100123

101124
If the static IP address defined in the *loadBalancerIP* property of the Kubernetes service manifest does not exist, or has not been created in the node resource group and no additional delegations configured, the load balancer service creation fails. To troubleshoot, review the service creation events with the [kubectl describe][kubectl-describe] command. Provide the name of the service as specified in the YAML manifest, as shown in the following example:
@@ -134,6 +157,8 @@ For additional control over the network traffic to your applications, you may wa
134157
135158
<!-- LINKS - External -->
136159
[kubectl-describe]: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#describe
160+
[azure-dns-zone]: https://azure.microsoft.com/en-us/services/dns/
161+
[external-dns]: https://github.com/kubernetes-sigs/external-dns
137162
138163
<!-- LINKS - Internal -->
139164
[aks-faq-resource-group]: faq.md#why-are-two-resource-groups-created-with-aks

0 commit comments

Comments
 (0)