Getting Started with Azure Kubernetes Services (AKS) Clusters

Introduction

In this article, we will learn and deploy the different types of services in the Azure Kubernetes Services (AKS) Clusters. Let's get started.

Azure Kubernetes Service

Azure Kubernetes Service (AKS) is a managed container orchestration service provided by Microsoft Azure. AKS allows us to manage the applications rather than the infrastructure.

AKS has an autoscaling feature and also simplifies the deployment of the application.

Types of AKS services

Azure Kubernetes Services

  • Cluster IP: Exposes the service on an internal IP in the cluster. Its default service is Kubernetes.
  • NodePort: Superset of ClusterIP. Exposes the service on the same port of each selected node in the cluster.
  • LoadBalancer: Superset of NodePort. Creates an external load balancer in the current cloud and assigns an external IP to the service.

Steps to Create AKS Cluster

Log in to the Azure portal (https://portal.azure.com/)

Azure Kubernetes Services

Search Kubernetes services in the search bar.

Azure Kubernetes Services

Click Create option in the Kubernetes Services window.

Azure Kubernetes Services

First, provide an Azure subscription.

Create a new resource group named testRG.

Type Kubernetes cluster name as retailcluster02.

Choose the Azure region as US West US.

Azure Kubernetes Services

Choose the Kubernetes version as default.

Select Node Size as the Standard DS2_v2 option, which is recommended for standard configuration.

Choose Scale Method as the Autoscale option.

Specify the Node Count range as a 1:3 combination means 1 Master Node and 3 Worker Nodes.

Click the Review+Create button.

Azure Kubernetes Services

You will get a message as Validation passed on the screen and click Create button.

Azure Kubernetes Services

Click Create button.

The deployment started initialized in a minute or two it will become successful.

Azure Kubernetes Services

Click the Go to Resource button.

Retailcluster02 appears on the screen in you click Connect button.

Azure Kubernetes Services

Once you clicked the connect to the cluster, it will be redirected to the Cloud shell option.

Azure Kubernetes Services

Once Cloud shell is opened and you have to create storage first.

Azure Kubernetes Services

Suppose the users type the commands as kubectl get svc. You can notice by default; it displays the ClusterIP service.

Azure Kubernetes Services

YAML File for nginx-deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

The users can expose the deployment to the NodePort by changing the type as NodePort in the expose command as

kubectl expose deployment nginx-deployment --name=np-service --type=NodePort

 

Azure Kubernetes Services

At last, the users can expose the deployment to the LoadBalancer service by changing the type.

kubectl expose deployment nginx-deployment --name=lb-service --type=LoadBalancer

 

Azure Kubernetes Services

Click Services & Ingresses in the retailcluster02 window.

The users can see the list of available Kubernetes resources.

 

Azure Kubernetes Services

Click the External IP option.

You will get nginx-deployment opened in the new tab with the welcome mess. Welcome to nginx!

 

Azure Kubernetes Services

Summary

In this article, we successfully created and deployed Azure Kubernetes Service cluster management and learned different types of service in the AKS cluster end-to-end deployment.

Thanks for reading this article!!!


Similar Articles