上一篇筆記我們建立好 AKS 叢集了, 這一篇筆記我們將介紹如何部署應用程式到 AKS 叢集中.
(部分資訊將會遮罩)
az acr list -g 15maksrg
取得 ACR loginServer
資訊PS C:\k8s\dotnet-docker\samples\aspnetapp> az acr list -g 15maksrg
[
{
"adminUserEnabled": false,
"creationDate": "2018-10-14T06:27:45.022863+00:00",
"id": "/subscriptions/11e5233d-dbe1-4167-ac91-????????????/resourceGroups/15maksrg/providers/Microsoft.ContainerRegistry/registries/15maksacr",
"location": "southeastasia",
"loginServer": "15maksacr.azurecr.io",
"name": "15maksacr",
"provisioningState": "Succeeded",
"resourceGroup": "15maksrg",
"sku": {
"name": "Basic",
"tier": "Basic"
},
"status": null,
"storageAccount": null,
"tags": {},
"type": "Microsoft.ContainerRegistry/registries"
}
]
code .\aspnetapp-deployment.yml
叫用 VS Code 修改 deployment manifest yaml file"15maksacr.azurecr.io"
kubectl apply -f .\aspnetapp-deployment.yml
完成部署PS C:\k8s\dotnet-docker\samples\aspnetapp> kubectl apply -f .\aspnetapp-deployment.y
ml
deployment.apps "aspnetapp-deployment" created
service "aspnetapp-service" created
kubectl get service --watch
觀察 Service 是否已經完成部署, 取得 Loadbalancer Public IP 位置後, 按 Ctrl+C
停止觀察PS C:\k8s\dotnet-docker\samples\aspnetapp> kubectl get service --watch
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
aspnetapp-service LoadBalancer 10.0.242.221 <pending> 80:31685/TCP 20s
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 26m
aspnetapp-service LoadBalancer 10.0.242.221 104.215.152.54 80:31685/TCP 1m
跟部署到 Local Kubernetes 叢集一樣, 是不是很簡單呢?