Welcome to the Fast Lane Blog!

Take a look around. Let us know if you have any questions.

AZ-204 Certification: Deploy an AKS cluster using Azure CLI

Posted by Derek Zhu on Aug 25, 2020 12:58:00 PM

Deploy an AKS cluster using Azure CLI

Four Steps to Deploy an AKS cluster

Step 1: Create a resource group

az group create --name myAKSCluster --location eastus

Step 2 : Create AKS cluster

az aks create --resource-group myAKSCluster --name myAKSCluster --node-count 1 --enable-addons monitoring --generate-ssh-keys

Step 3: Connect to the cluster

az aks get-credentials --resource-group myAKSCluster --name myAKSCluster

Step 4: Run the application using kubectl

kubectl apply -f azure-vote.yaml

 

Example of azure-vote.yaml file:

apiVersion: apps/v1beta1

kind: Deployment

metadata:

name: azure-vote-back

spec:

replicas: 1

template:

   metadata:

     labels:

       app: azure-vote-back

   spec:

     nodeSelector:

       "beta.kubernetes.io/os": linux

     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

strategy:

   rollingUpdate:

     maxSurge: 1

     maxUnavailable: 1

minReadySeconds: 5

template:

   metadata:

     labels:

       app: azure-vote-front

   spec:

     nodeSelector:

      "beta.kubernetes.io/os": linux

     containers:

     - name: azure-vote-front

       image: microsoft/azure-vote-front:v1

       ports:

       - containerPort: 80

       resources:

         requests:

           cpu: 250m

         limits:

           cpu: 500m

       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

 

References:

https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough

Topics: Microsoft, Microsoft Azure

Need help choosing a training path that's right for you?

Drop us a line here and one of our education services consultants will reach out!