Step 1 : Login to portal.azure.com Kubernetes Services -> Create a Kubernetes cluster
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
Step 3: Change the size of the cluster to B2S ( Because cluster should have 4GB of memory)
Step 4: By default Node count range will go to 5 but demo change to 1 then click on Review and Create
Step 5: View all the changes then click on Create
Step 6: AKS Cluster will take time of 5 to 10 minutes to create
Step 7 : Then the newly created cluster will show in Kubernetes services and then click on the cluster : srini-aks
Step 8: Click on Connect
Steps 9: steps to connect cluster will be shown in the azure portal
- az account set --subscription SubscriptionId
- az aks get-credentials --resource-group devopsTraining --name srini-linux
- SubscriptionId : Need to replaced with the subscription id
- resource group : Need to update resource group, where you have created cluster
- 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
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.
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/
Top comments (0)