Deploy a webserver using Azure Kubernetes Service

We will be looking at setting up an Azure Kubernetes Cluster and then deploying an nginx web server on it.

Azure Kubernetes

To deploy an Azure Kubernetes Cluster, login to with your credentials and search for kubernetes service.

Searching for Kubernetes Service

Fill in the details as seen below:


You can leave the node pools section with the default parameters as seen below:

Node pools

The Authentication section can also take the default parameters as seen below:

The dns name is automatically created for you as seen below:

Networking section

The Log analytics workspace is also created by default:

You can decide to add tags if it helps to identify your resources then proceed to review all changes and ensuring the validation is passed as below and then proceed to click on the create button to create the kubernetes cluster:

Review + Create section

Once the deployment is done, you will see a screen as below. Click on Connect to cluster to be able to connect to the cluster.

Cluster Deployment Complete

A cloud shell environment is provided by clicking on We will be connecting to the cluster using commands we run from the cloudshell.

Some of the sample commands are as seen below:

Run the following commands to connect to your cluster:
az account set -subscription xxxx-xxxx–xxxx-xxxx–xxxx
az aks get-credentials -resource-group azurekubernetes -name azurekubernetes

Next we deploy the webserver in the cluster by running the command below:
kubectl run webserver -generator=run-pod/v1 -image=nginx

Pod webserver deployment

Once you have deployed the pod, next you create a service to expose the pod so it can be accessible over the internet by running the command below:
kubectl expose pod webserver -type=LoadBalancer -name=podwebserver-service -port=80

To get the public IP of the pod, run the command:
kubectl get service

To confirm that you can access the pod from the internet, put in the public Ip on your local browser and you should be able to access the webserver as seen below:

nginx webserver

You can also get the full view of the pod by describing it as below:

webserver pod description

In summary, you can see how easy it is to deploy a webserver using Azure kubernetes service. So go on and try your hands on making use of the AKS environment and send me your feedback on “” as I would love to hear from you.