﻿![]()

#### 

Running Sitecore in the Azure Kubernetes Services (AKS), Nginx Ingress controller provides a public IP address that we can use to bind a hostname and root traffic to the environment. But in case of any update/redeploy of the ingress controller, the public IP address will be changed which means the website will be unavailable until DNS records are not updated. To avoid this website downtime we need to set up a static public IP address for the ingress controller.

There are two ways to create a public IP address within Azure Subscription:

- create a Public IP in a cluster’s resource group that is created within Kubernetes cluster;
- create a Public IP within any other Resource Group.

In first case we need to get a cluster’s resource group name. The following command can be used for that:

| *az aks show --resource-group **&lt;Resource-Group-Name&gt;** --name **&lt;Kubernetes-Cluster-Name&gt;** --query nodeResourceGroup -o tsv* |
| --- |

where *Resource-Group-Name* is a name of the resource group where our cluster is created. Usually the cluster’s resource group name looks like:

*MC\_**&lt;Resource-Group-Name&gt;\_&lt;Kubernetes-Cluster-Name&gt;\_&lt;Cluster-Region&gt;***

Then we need to create a Public IP using the following command:

| *az network public-ip create --resource-group MC\_**&lt;Resource-Group-Name&gt;\_&lt;Kubernetes-Cluster-Name&gt;\_&lt;Cluster-Region&gt;** --name **&lt;IP-Address-Label-Name&gt;** --sku Standard --allocation-method static* |
| --- |

In the second case the following command is used to create a static Public IP:

az network public-ip create --resource-group **&lt;Resource-Group-Name&gt;** --name **&lt;IP-Address-Label-Name&gt;** --sku Standard --allocation-method static

Then we need to ensure the cluster identity used by the AKS cluster has delegated permissions to the other resource group. For example:

| az role assignment create \<br>
                --assignee &lt;Client ID&gt; \<br>
                --role "Network Contributor" \<br>
                --scope /subscriptions/&lt;subscription id&gt;/resourceGroups/&lt;resource group name&gt; |
| --- |

To get a newly created IP we need to run the following command:

az network public-ip show --resource-group **&lt;Resource-Group-Name&gt;** OR MC\_**&lt;Resource-Group-Name&gt;\_&lt;Kubernetes-Cluster-Name&gt;\_&lt;Cluster-Region&gt;**  --name **&lt;IP-Address-Label-Name&gt;** --query "{address: ipAddress}"

Once we have a Public IP address added, we need to add two additional lines to the install ingress controller command:

| helm install nginx-ingress ingress-nginx/ingress-nginx `<br>
            <br>--set controller.replicaCount=2 `<br>
            <br>--set controller.nodeSelector."beta\.kubernetes\.io/os"=linux `<br>
            <br>--set defaultBackend.nodeSelector."beta\.kubernetes\.io/os"=linux `<br>
            <br>--set controller.service.loadBalancerIP=&lt;PUBLIC-IP-ADDRESS&gt; `<br>
            <br>--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-dns-label-name"=&lt;some-label&gt; `<br>
            <br>--set controller.admissionWebhooks.patch.nodeSelector."beta\.kubernetes\.io/os"=linux `<br>
            <br>--set-string controller.config.proxy-body-size=10m |
| --- |

To make sure that everything is as expected, we can run a command below:

**kubectl get services**

The result of execution should look like following:

![](https://www.brimit.com/-/media/images/blog/apr/image1.png?h=45&amp;w=700&amp;hash=ED118F0525E133E9986B08B5D37DDE71)

where EXTERNAL-IP should be the same as newly created. If you see &lt;pending&gt; instead, the following command can be useful for troubleshot:

***kubectl describe service nginx-ingress-ingress-nginx-controller***

###### Author

[!\[artsiom-photo\](https://www.brimit.com/-/jssmedia/feature/blogs/authors/artsiom-200.jpg?h=202&amp;iar=0&amp;w=200&amp;hash=41797D2540DF6EB6FDF558360F6F62B8)
Artsem Prashkovich
Sitecore MVP/ Solution Architect](https://www.brimit.com/blog/author?authors=Artsem%20Prashkovich)

###### More By Categories

[#E-commerce](https://www.brimit.com/blog?categories=#E-commerce)[#How-to](https://www.brimit.com/blog?categories=#How-to)[#Guides](https://www.brimit.com/blog?categories=#Guides)[Tech Talks](https://www.brimit.com/blog?categories=Tech%20Talks)[#OrderCloud](https://www.brimit.com/blog?categories=#OrderCloud)

###### More by Platform

[Data and AI](https://www.brimit.com/blog?platforms=Data%20and%20AI)[DXP](https://www.brimit.com/blog?platforms=DXP)[E-commerce](https://www.brimit.com/blog?platforms=E-commerce)[Internet of Things](https://www.brimit.com/blog?platforms=Internet%20of%20Things)[Sales and marketing automation](https://www.brimit.com/blog?platforms=Sales%20and%20marketing%20automation)

#### More on Sitecore

[!\[How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2024/vercel_cover-image.png)
#Guides#How-toDXPE-commerce
##### How Vercel Will Help You Save Effort When Deploying Sophisticated Sitecore Projects
Optimize and accelerate the development and deployment of complex multisite Sitecore projects.
Alexei Vershalovich on July 17, 2024](https://www.brimit.com/blog/how-vercel-will-help-you-save-effort-when-deploying-sophisticated-sitecore-projects)

[!\[Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2023/sitecore-mentoring---cover-image.png)
#How-toDXP
##### Training Up Tomorrow's Sitecore MVPs: a Mentoring Success Story
How to participate in the Sitecore Mentor program and help younger colleagues jump-start a career in Sitecore development.
Sergey Baranov on October 2, 2023](https://www.brimit.com/blog/training-up-tomorrows-sitecore-mvps)

[!\[Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)\](https://www.brimit.com/-/jssmedia/project/brimit/blog/2022/headless/adobestock_456986731.jpg)
#How-toDXPE-commerce
##### Going Headless. Part 2: When a Headless CMS Is Your Best Bet (if you have Sitecore)
Discover how a headless CMS can benefit organizations that use Sitecore.
Daniil Raschupkin, Palina Trokhautsava on September 15, 2022](https://www.brimit.com/blog/going-headless-part-2-when-a-headless-cms-is-your-best-bet-if-you-have-sitecore)

![](https://bat.bing.net/action/0?ti=187017043&amp;tm=gtm002&amp;Ver=2&amp;mid=7a448d3c-254a-4200-ad07-4006983bdb10&amp;bo=2&amp;gtm_tag_source=1&amp;pi=0&amp;lg=en-US&amp;sw=800&amp;sh=600&amp;sc=24&amp;nwd=1&amp;tl=Use%20a%20static%20public%20IP%20address%20with%20Sitecore%20in%20AKS&amp;kw=Kubernetes,%20Sitecore,%20Debug,%20Powershell,%20AKS,%20Cluster,%20nginx-ingress&amp;p=https%3A%2F%2Fwww.brimit.com%2Fblog%2Fuse-a-static-public-ip-address-with-sitecore-in-aks&amp;r=&amp;lt=291&amp;evt=pageLoad&amp;sv=2&amp;asc=D&amp;cdb=AQAY&amp;rn=420234)