Following my previous articles about Azure Kubernetes Cluster (AKS) today, I will show you how I deploy a web application to AKS using a .YAML file.
About AKS
Released a few weeks ago and currently, in public preview, AKS offers a managed Kubernetes cluster that can be scaled up and on-demand without needing to configure Containers, host, storage networks, etc.
Requirements
To get the Web App running in AKS you will a running AKS cluster with minimum one Node.
For setup instructions visit my article about Deploying AKS in Azure.
Get Started
In this post, I will be using the Kubernetes Web UI (Dashboard) which comes with AKS to deploy the application and below I will connect to my AKS dashboard.
Once connected to the Dashboard I will click on create
In the create from text Input screen, I will paste my .YAML file content (the file is a basic voting app released by Microsoft)
kind: Deployment
metadata:
apiVersion: apps/v1beta1
name: azure-vote-back
spec:
replicas: 1
template:
metadata:
labels:
app: azure-vote-back
spec:
containers:
– name: azure-vote-back
image: redis
ports:
– containerPort: 6379
name: redis
—
apiVersion: v1
kind: Service
metadata:
name: azure-vote-back
spec:
ports:
– port: 6379
selector:
app: azure-vote-back
—
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: azure-vote-front
spec:
replicas: 1
template:
metadata:
labels:
app: azure-vote-front
spec:
containers:
– name: azure-vote-front
image: microsoft/azure-vote-front:v1
ports:
– containerPort: 80
env:
– name: REDIS
value: “azure-vote-back”
—
apiVersion: v1
kind: Service
metadata:
name: azure-vote-front
spec:
type: LoadBalancer
ports:
– port: 80
selector:
app: azure-vote-front
Once the file was paste I will click on Upload
Once deployed AKS will deploy the application to the Cluster
Access the application
To access the application I will click on the Services button and I will see my application (Azure-vote-front) and a direct IP address to it.
All I need to do now is click on the link and see if the app is working.
As you can see the link is working and the MS Azure Voting app is live
You can download the entire Azure voting app from Github