Azure has made it easy to deploy your applications to a Kubernetes cluster with Azure Kubernetes Service (AKS).
AKS is a managed Kubernetes service that makes it easy to deploy, manage, and scale containerized applications. This blog post will walk you through the steps necessary to deploy an application to an AKS cluster.
Manifest File
Kubernetes manifest files are used to describe the desired state of a cluster or individual Kubernetes objects. Manifest files are written in YAML and can deploy applications, services, and more. This blog post will walk you through the steps necessary to deploy an application to an AKS cluster using a manifest file.
Below is the manifest file I will use to deploy a simple application to AKS (Using Ubuntu image). The file is called deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: server-deployment
spec:
selector:
matchLabels:
app: server-app
template:
metadata:
labels:
app: server-app
spec:
containers:
- name: server-app
image: ubuntu
command: ["/bin/sh"]
args: ["-c", "sleep infinity"]
restartPolicy: Always
Login and Authenticate
To deploy the application, we need to use Azure CLI. I will log in to Azure from my terminal and authenticate to my cluster using the two commands below. Make sure you know your cluster resource group name and cluster name.
az login
az aks get-credentials --resource-group aks --name akscluster01
Deploy
The final will be deploying the application using the following kubectl command.
kubectl apply -f deployment.yaml
To check the deployment run
kubectl get pods
Please visit the following blog post if you have trouble logging into your AKS cluster using Azure CLI.
How To Connect to an Azure Kubernetes Service (AKS) Cluster With Azure CLI and Kubectl
Leave a Reply