I deployed application on azure kubernetes. When I create azure kubernetes cluster , it was with single node which i assume to be 1 virtual machine.
Now I scaled my deployment.
kubectl scale --replicas=3 deployment/kubdemo1api
after this i fire kubectl get pods
kubdemo1api-776dfc99cc-c72qg 1/1 Running 0 1m
kubdemo1api-776dfc99cc-n7xvs 1/1 Running 0 1m
kubdemo1api-776dfc99cc-xghs5 1/1 Running 0 13m
which tells me that now there are 3 instances of my deployment running.
However If i go to azure portal kubernetes cluster.
I still continue to see 1 node . This is confusing me , as to how is scaling working in aks and where are the scaled instances getting deployed.
You are confusing virtual machines with containers. Nodes are virtual machines, pods are containers (essentially). When you scale deployment you add pods. You cannot scale nodes from within kubernetes yet.
If you do kubectl get nodes
you will see virtual machines.
Pods: https://kubernetes.io/docs/concepts/workloads/pods/pod/
Nodes: https://kubernetes.io/docs/concepts/architecture/nodes/
As @4c74356b41 said the nodes in AKS are the Azure VM and the pods are containers run on the nodes. A pod represents a single instance of your application. When you run the command:
kubectl scale --replicas=3 deployment/kubdemo1api
It means you run three instances of your application on the node. And it will not change the number of the AKS nodes.
If you want to scale the number of the AKS nodes, you need to run the Azure CLI below instead of the Kubectl command:
az aks scale --name yourAKS --node-count 3 --resource-group yourResourceGroup
The command az aks scale
helps you scale the AKS nodes, not pods. For more details about them, see Nodes and Pods in AKS.