Reading Time: 4 minutes
With Azure Container Service you can create, configure and manage a cluster of VMs that can run containerized apps. Bellow all the steps that someone needs to follow to create the first Azure Container Service (AKS)

 Prerequisites

  1. Create Service principal client ID
  2. Create Service principal client secret
  3. Download and install puttygen
  4. Download and install kubectl package  latest version
  5. Download and install cmder tool

Create Service Principal client ID

 Azure Active DirectoryApp registrationsNew application registration

Register a New application form parameters as the next image

Next, you need to copy the Application ID from the DemoClusterApplication and keep it for the AKS Cluster creation.

Create Service principal client secret

Select SettingsKeys, and create a key [MUST copy and keep somewhere safe the key value because after the first saving it is not visible]. 

Create Azure Container Service (AKS)

After the steps 1, 2 are completed you’re ready to move to the next step which is to create Azure Container Service (AKS)

Create a Resource Group

Provide name, Subscription, RG location and click Create.

Create a new resource, an Azure Container Service – AKS (preview) as follows and click OK.

On the Configuration blade type details as follows and click OK.

After a couple of minutes the cluster is ready. A new Resource Group is created, with all new resources in it

Connect to the cluster

Now you are ready to connect to the cluster. Open the cmder tool, and type the commands with the following order :

  1. az login  {Login to Azure}

2. Authenticate the Login by following the instruction on the step 1.

3. Select the Resource Group and the cluster Name.

4.Next, verify the connection to cluster

5. Create the .yaml file (This is the Kubernetes manifest file which include the cluster container images.) 5.1 Create democluster.yaml in  C:\Users\username\.kube, copy the following YAML code and type the command kubectl create -f democluster.yaml

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: az-demo-cluster-back
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: az-demo-cluster-back
    spec:
      containers:
      - name: az-demo-cluster-back
        image: redis
        ports:
        - containerPort: 6379
          name: redis
---
apiVersion: v1
kind: Service
metadata:
  name: az-demo-cluster-back
spec:
  ports:
  - port: 6379
  selector:
    app: az-demo-cluster-back
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: az-demo-cluster-front
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: az-demo-cluster-front
    spec:
      containers:
      - name: az-demo-cluster-front
        image: microsoft/az-demo-cluster-front:v1
        ports:
        - containerPort: 80
        env:
        - name: REDIS
          value: "az-demo-cluster-back"
---
apiVersion: v1
kind: Service
metadata:
  name: az-demo-cluster-front
spec:
  type: LoadBalancer
  ports:
  - port: 80
  selector:
    app: az-demo-cluster-front

6. Last step is to test the app, just type the following commands

7. App is up and running  🙂

Share This