Open In App

How To Use Azure Kubernetes Service For Container Orchestration ?

Last Updated : 21 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Azure Kubernetes Service provides a platform for managing containers with the help of Kubernetes. It also provides an easy and managed way for the deployment and scaling of containerized applications. Containerized applications are deployed in the Kubernetes cluster in Azure. Let’s see how to use the Azure Kubernetes Service for deploying containerized applications.

Primary Terminologies

  • Kubernetes: It is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications.
  • Kubernetes Cluster: It is a set of nodes on which containerized applications run.
  • Container orchestration is a term referring to the management and configuration of containers.

Using the Azure Kubernetes Service for container orchestration

Step 1:

  • Before proceeding with the usage, first create a Kubernetes cluster in Azure.
  • On the Azure portal, click on Cloud Shell.
  • Run the below command to create a cluster. Specify your resource group and cluster name in the command.

AKS Cluster Creation

  • On successful running the command should show output as cluster details.
  • We can also specify node count and other properties for cluster from command.
  • Add credentials for connecting to Kubernetes cluster by running below command. Replace resource group and cluster name from previous command.

Credential

  • To see whether the cluster is deployed successfully run below command. It should show running nodes in cluster.

Nodes

As you can see cluster is deployed with single node successfully.

Step 2: Now go to cluster overview page to view cluster configuration. You should similar output as below.

Cluster

Lets deploy one sample application on cluster.

  • Go to cloud shell and run below command to get cluster credentials
az aks get-credentials --resource-group <your_resource_group_name> --name <your_aks_cluster_name>

Get Credentials

  • You can now use kubectl. We can verify it using running any kubectl command like below.

Nodes

Step 3: Now lets deploy a simple NGINX server on kubernetes. Lets create a YAML file for the same. In cloud shell run below command

nano nginx-deployment.yaml

Add below lines to file when nano is opened.

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

press ctrl+o and ctrl+x to save and exit.

  • Now lets apply the deployment by running below command.
kubectl apply -f nginx-deployment.yaml

Deployment

  • You can verify the deployment using below command
kubectl get deployment nginx-deployment --watch

Pods

Step 4:

  • Lets expose the nginx on a service to access it externally.
  • just like previos step create service.yaml file and below lines to it.
apiVersion: v1
kind: Service
metadata:
name: gfgnginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer

  • apply the configuration using below command.
kubectl apply -f nginx-service.yaml

Service

  • check the deployment using below command.
kubectl get service gfgnginx-service --watch

Service LoadBalancer

  • Copy the external id paste in browser to see deployed server.

Nginx

Step 5: You can manage containers from console as follow.

  • on console from cluster overview page go to node pools from left pane. Open node pool from list.
  • From left pane click on nodes you can see running nodes in the cluster.

Nodes

  • Click on any node to see the pods. On this page from left pane click on pods. we can see number of listed pods along nginx-deployment pods.

Agent Pool

  • Click on any one of pod. Here you can see deployed container with its image name.
    Nginx Deployment
  • You can also see other components and services in cluster using AKS and manage them.

Conclusion

Thus, we have seen Azure Kubernetes Service can be used for running and orchestrating containerized applications. It provides easy way to create and deploy containers. It also gives overview Kubernetes cluster which is very helpful in complex application architectures.

How to use Azure Kubernetes Service for container orchestration – FAQ’s

What is the service in Azure which can be used for container orchestration?

In Azure, the service used for container orchestration is Azure Kubernetes Service (AKS). AKS simplifies the deployment, management, and scaling of containerized applications using Kubernetes. It provides a fully managed Kubernetes service, allowing you to focus on deploying and managing your applications rather than the underlying infrastructure.

Is Kubernetes used for container orchestration?

Yes, Kubernetes is a popular open-source platform for container orchestration. It automates the deployment, scaling, and management of containerized applications. Kubernetes provides a robust and flexible framework for orchestrating containers, allowing users to abstract away many of the complexities associated with deploying and managing containerized workloads. It has become a standard for container orchestration in cloud-native and microservices-based application architectures.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads