DEV Community

Cover image for AKS Creation - Step by Step Approach
Srinivasulu Paranduru
Srinivasulu Paranduru

Posted on • Edited on

AKS Creation - Step by Step Approach

Step 1 : Login to portal.azure.com Kubernetes Services -> Create a Kubernetes cluster

Image description

Step 2 : Enter the mandatory fields
Subscription : Select the subscription
Resource Group : Create one if does not exists / select the existing one
Cluster present configuration : Standard ($$) (selected Standard from the list )
Kubernetes cluster name : srini-aks
Region : (Europe)UK South

Image description

Step 3: Change the size of the cluster to B2S ( Because cluster should have 4GB of memory)

Image description

Step 4: By default Node count range will go to 5 but demo change to 1 then click on Review and Create

Image description

Step 5: View all the changes then click on Create

Image description

Step 6: AKS Cluster will take time of 5 to 10 minutes to create

Image description

Step 7 : Then the newly created cluster will show in Kubernetes services and then click on the cluster : srini-aks

Image description

Step 8: Click on Connect

Image description

Steps 9: steps to connect cluster will be shown in the azure portal

Image description

  • az account set --subscription SubscriptionId
  • az aks get-credentials --resource-group devopsTraining --name srini-linux
  1. SubscriptionId : Need to replaced with the subscription id
  2. resource group : Need to update resource group, where you have created cluster
  3. name : Name of the cluster

Once you have run the command above to connect to the cluster, you can run any kubectl commands. Here are a few examples of useful commands you can try.

List all deployments in all namespaces

kubectl get deployments --all-namespaces=true

List all deployments in a specific namespace

Format :kubectl get deployments --namespace

kubectl get deployments --namespace kube-system

List details about a specific deployment

Format :kubectl describe deployment --namespace

kubectl describe deployment my-dep --namespace kube-system

List pods using a specific label

Format :kubectl get pods -l = --all-namespaces=true

kubectl get pods -l app=nginx --all-namespaces=true

Get logs for all pods with a specific label

Format :kubectl logs -l =

kubectl logs -l app=nginx --namespace kube-system

*Step10 *: Open Cloud Shell or the Azure CLI and run all the commands one by one . Subscription id varies based on your subscription

Step11 : During the process of running the commands from step 10
.kube folder will be created under which user the commands ran

Image description

Step12 : Run Kubectl commands
12.1 Get Nodes
kubectl get nodes
NAME STATUS ROLES AGE VERSION
aks-agentpool-39508002-vmss000000 Ready agent 23m v1.24.9
12.2 kubectl get pods
No resources found in default namespace.
12.3 Create POD
kubectl run srini-nginx --image=nginx
pod/srini-nginx created
12.4 List PODS
kubectl get pods
NAME READY STATUS RESTARTS AGE
nginx 1/1 Running 0 8s

**Step 13: **Delete the AKS Cluster and it will delete the nodes then the cluster will be deleted in 5 to 10 minutes.

Image description

Wrapup
Step by step approach for creation of AKS K8s cluster and please let me know the comments for this article.

LinkedIn : https://www.linkedin.com/in/srinivasuluparanduru/

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay