Kubernetes on Azure (AKS) – Only Demo Purposes

Linn Latt OoLinn Latt Oo
3 min read

Whether you're a student, developer, or DevOps engineer preparing for a demo, this guide walks you through setting up AKS for demo purposes quickly and efficiently.

Let’s get started!

Prerequisites

Creating Kubernetes cluster

Visit Azure portal and log in with your Azure account. On the top search bar, type Kubernetes services and select it. Click the "+ Create" button and choose "Create Kubernetes cluster".

Configure the basic settings according to your needs. The image below shows an example configuration for demo purposes only.

Once your AKS cluster is ready, follow the connection instructions provided under the "Connect" section in the Azure Portal to configure kubectl access.

Note: In the screenshot, I skipped the az login step because I was already logged in.

az login
az account set --subcription <subcription-id>
az aks get-credentials --resource-group <resource-group-name> --name <k8s-cluster-name> --overwrite-existing

To verify your connection to the cluster, run:

kubectl get svc

You should see the default Kubernetes services listed, confirming the connection.

Below is the architecture, along with the deployment and service configuration files used in this demo.

Disclaimer: These files are originally created by KodeKloud. I'm using them solely for demonstration purposes. You can fork the original files from their public repository.

I made a small modification:
Changed the service type to LoadBalancer for both vote-service and result-service (the frontends) to allow external access.

Let’s Deploy

As you can see in the screenshot, I have these manifest files (vote-deployment.yaml, vote-service.yaml, result-deployment.yaml, result-service.yaml, db-deployment.yaml, db-service.yaml, redis-deployment.yaml, redis-service.yaml, worker-deployment.yaml).

To deploy the applications to your AKS cluster, use the kubectl apply command, specifying the -f flag followed by the name of each manifest file:

kubectl apply -f vote-deployment.yaml
kubectl apply -f vote-service.yaml
kubectl apply -f result-deployment.yaml
kubectl apply -f result-service.yaml
kubectl apply -f db-deployment.yaml
kubectl apply -f db-service.yaml
kubectl apply -f redis-deployment.yaml
kubectl apply -f redis-service.yaml
kubectl apply -f worker-deployment.yaml

As shown in the screenshot, each kubectl apply command will create the corresponding deployment and service in your AKS cluster.

To verify that the deployments and services have been created successfully, you can use the kubectl get deployments,svc command:

kubectl get deployments,svc

The output, as seen in the screenshot, will display the list of deployments and services along with their current status, the number of ready replicas, their age, and for services, their type, cluster IP, external IP, and exposed ports.

Similarly, the services (service/vote, service/result, service/db, service/redis) will be listed with their respective details in Azure portal. Notice that the vote and result services are of type LoadBalancer, which means Azure Kubernetes Service has provisioned external load balancers to make these applications accessible from outside the cluster. You can see their external IPs listed in the "EXTERNAL-IP" column.

You can now access the voting application and the results application using the external IPs provided for the vote and result services, respectively, in your web browser.

Congratulations! You have successfully deployed a multi-tier application to your Azure Kubernetes Service cluster using kubectl. This demonstrates the basic steps involved in deploying and managing applications on AKS.

Don’t forget to delete the resources to avoid extra charges.

Thanks for reading!

0
Subscribe to my newsletter

Read articles from Linn Latt Oo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Linn Latt Oo
Linn Latt Oo