今天的筆記將介紹如何調整 AKS 的叢集節點與手動擴充 Pod 數量
(部分資訊將會遮罩)
--node-count 3
將節點改為 3 個PS C:\k8s\dotnet-docker\samples\aspnetapp> az aks scale -g 15maksrg --name 15makscls --node-count 3
- Running ..
{
"aadProfile": null,
"addonProfiles": null,
"agentPoolProfiles": [
{
"count": 3,
"maxPods": 110,
"name": "nodepool1",
"osDiskSizeGb": null,
"osType": "Linux",
"storageProfile": "ManagedDisks",
"vmSize": "Standard_DS2_v2",
"vnetSubnetId": null
}
],
"dnsPrefix": "a15makscls-15maksrg-11e523",
"enableRbac": true,
"fqdn": "a15makscls-15maksrg-11e523-????????????.hcp.southeastasia.azmk8s.io",
"id": "/subscriptions/11e5233d-dbe1-4167-ac91-????????????/resourcegroups/15maksrg/providers/Microsoft.ContainerService/managedClusters/15makscls",
"kubernetesVersion": "1.9.9",
"linuxProfile": {
"adminUsername": "azureuser",
"ssh": {
"publicKeys": [
{
"keyData": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLHKDspxhg5mViXToaAwchZU+aFgnOpYKIFqn9Jy55PakxcrW08Goq5kVNz8jOYlAREeUpemx/s8pR/Zop1avkpBBqScNqH/dCZTvac1tc6EwE2977iD8XyJcZokrUKwdJ4U99z9vYsnOW+MMsYh+XH/3qOpCCmFcPjqNCwd4UV5QeFHsREShIz7jTJnArcgkImDRfx5eQZracHjydXWG9Z4rryW3eB0pgjg9To8N2LzTXK0/J+suPiYWiBBLGQStpsw8Q01EaKQGLWl9jKaqZ13fUgwes9bk7JWuy0bBNoHP5s+mHDuuyQer+qdEDtj6+kp6Vj4Ydp6X????????????M5"
}
]
}
},
"location": "southeastasia",
"name": "15makscls",
"networkProfile": {
"dnsServiceIp": "10.0.0.10",
"dockerBridgeCidr": "172.17.0.1/16",
"networkPlugin": "kubenet",
"networkPolicy": null,
"podCidr": "10.244.0.0/16",
"serviceCidr": "10.0.0.0/16"
},
"nodeResourceGroup": "MC_15maksrg_15makscls_southeastasia",
"provisioningState": "Succeeded",
"resourceGroup": "15maksrg",
"servicePrincipalProfile": {
"clientId": "3f45ecdb-ea70-45f5-bddc-????????????",
"secret": null
},
"tags": null,
"type": "Microsoft.ContainerService/ManagedClusters"
}
kubectl get nodes
確認節點是否正確配置完成PS C:\k8s> kubectl get nodes
NAME STATUS ROLES AGE VERSION
aks-nodepool1-25432928-0 Ready agent 46m v1.9.9
aks-nodepool1-25432928-1 Ready agent 37s v1.9.9
aks-nodepool1-25432928-2 Ready agent 1m v1.9.9
--replicas=5
deployment/aspnetapp-deployment 將 Replica set 修改為 5 個PS C:\k8s> kubectl scale --replicas=5 deployment/aspnetapp-deployment
deployment.extensions "aspnetapp-deployment" scaled
kubectl get deployment
確認 deployment 數量是否完成配置PS C:\k8s> kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
aspnetapp-deployment 5 5 5 2 22m
kubectl get pods
確認 Pod 數量是否完成配置PS C:\k8s> kubectl get pods
NAME READY STATUS RESTARTS AGE
aspnetapp-deployment-655457c855-g4sz9 1/1 Running 0 30s
aspnetapp-deployment-655457c855-khlm8 1/1 Running 0 22m
aspnetapp-deployment-655457c855-nhgcl 1/1 Running 0 22m
aspnetapp-deployment-655457c855-nswxm 1/1 Running 0 30s
aspnetapp-deployment-655457c855-nvk78 1/1 Running 0 30s
我們完成了 Azure Kubernetes Service (AKS) 的節點擴充與 Pod 數量擴充, 下一篇筆記我們將介紹如何設定自動擴充 Pod 數量.
小叮嚀:
若您練習完成後, 請記得再將節點數改回 1
, 因為多產生的節點的 VM 是會計費了喔!