Soruce Code from "Introduction to .Net Microservices"
az aks install-cli
docker build . -t helloaks:0.0.1
docker tag helloaks:0.0.1 helloaksazurecontainerregistry.azurecr.io/hello-aks:0.0.1
3. Login to existing Azure Container Registry : HelloAKSAzureContainerRegistry from "myprojects" resource group
In portal.azure.com create an ACR(named HelloAKSAzureContainerRegistry) and an AKS Cluster (named HelloAKSKubeCluster)
#Integrate an existing ACR with existing AKS clusters by supplying valid values for acr-name or acr-resource-id as below:
az aks update -n HelloAKSKubeCluster -g myprojects --attach-acr HelloAKSAzureContainerRegistry
az acr login -n HelloAKSAzureContainerRegistry az login Login Succeeded
docker push helloaksazurecontainerregistry.azurecr.io/hello-aks:0.0.1
az acr repository list -n helloaksazurecontainerregistry
docker tag hello-aks:0.0.1 HelloAKSAzureContainerRegistry.azurecr.io/hello-aks:0.0.1
# download cluster configuration for kubectl from "myprojects" group
az aks get-credentials -n HelloAKSKubeCluster -g myprojects
# verify kubectl context
kubectl config get-contexts # prints all cluster contexts
# if kubectl does not point to HelloAKSKubeCluster, switch context
kubectl config use-context HelloAKSKubeCluster
kubectl apply -f pod.yml
kubectl apply -f service.yml
# wait for service to receive its external IP
kubectl get svc -w
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-aks LoadBalancer 10.0.94.52 20.71.74.14 8088:30107/TCP 63s
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 69m
kubectl get pods -o wide
kubectl get endpoints
curl http://20.71.74.14:8088/weatherforecast # the ip and the port are taken from above output : EXTERNAL-IP PORT(S)
kubectl delete pod first-netcore-app-pod