Updated 10. Setting the solution up in AKS (Azure Kubernetes Service) (markdown)

Cesar De la Torre 2018-05-17 12:45:46 -07:00
parent e1d5bd83e0
commit b8f7c8f539

@ -1,10 +1,51 @@
eShopOnContainers supports deployment to Kubernetes for simulated production scenarios where you need to scale-out your containers.
Currently, eShopOnContainers supports AKS (Azure Kubernetes Service) and ACS-Kuberentes (Azure Container Service for Kuberentes), but we recommend to use AKS as ACS will be deprecated in the future favoring AKS which offers further PaaS features for the cluster's infrastructure, automatic updates/patch on the VMs, etc.
# Introduction
eShopOnContainers supports deployment to Kubernetes clusters for "simulated" production scenarios where you need to scale-out your containers.
Currently, eShopOnContainers supports [AKS (Azure Kubernetes Service)](https://docs.microsoft.com/en-us/azure/aks/intro-kubernetes) and [ACS-Kuberentes (Azure Container Service for Kuberentes)](https://docs.microsoft.com/en-us/azure/container-service/kubernetes/container-service-intro-kubernetes), but we recommend to use AKS since ACS will be deprecated in the future favoring AKS which offers further PaaS features for the cluster's infrastructure, automatic updates/patch on the VMs, etc.
Common info for eShopOnContainers on Kuberentes (including both environments, AKS and ACS) is available here:
https://github.com/dotnet-architecture/eShopOnContainers/blob/dev/k8s/README.k8s.md
However, this post is going to focus specifically on AKS (Azure Kubernetes Service) deployment.
However, this post focuses specifically on AKS (Azure Kubernetes Service) deployment of eShopOnContainers.
# Prerequisites
* A Docker development environment with `docker` and `docker-compose`.
* Visit [docker.com](https://docker.com) to download the tools and set up the environment. Docker's [installation guide](https://docs.docker.com/engine/getstarted/step_one/#step-3-verify-your-installation) covers verifying your Docker installation.
* Azure cli 2.0 or later
Azure cli 2.0 or later must be installed in your dev machine [installation guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli).
* The Kubernetes command line client, `kubectl`.
* This can be installed with the `az` tool as described in the Azure Container Service [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough). `az` is also helpful for getting the credentials `kubectl` needs to access your cluster. For other installation options, and information about configuring `kubectl` yourself, see the [Kubernetes documentation](https://kubernetes.io/docs/tasks/kubectl/install/).
* A Kubernetes cluster in AKS.
You can follow any of the following approaches in order to create a Kubernetes cluster in AKS:
A. Create an AKS cluster with Azure portal: [Walkthrough](https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough-portal)
B. Create an AKS cluster with Azure CLI: [Walkthrough](https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough)
* A private Azure Container Registry (ACR)
[ACR](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-intro) is a managed Docker registry service based on the open-source Docker Registry 2.0. With ACR you create and maintain Azure container registries to store and manage your private Docker container images.
It is important to have a Docker registry, holding your private images, located in the same Datacenter/area than your orchestrator cluster, so when pulling images it'll go faster than if you use a remote Docker registry like Docker Hub. In addition, ACR offers significant value-added like global availability and global replication, etc.
You can follow any of the following approaches:
A. Create an ACR registry with Azure portal: [Walkthrough](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal)
B. Create an ACR registry with Azure CLI: [Walkthrough](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli)
* Alternatively: Create ALL the Azure infrastructure with an eShopOnContainer's ready-to-go script
Optionally, previous steps related to Azure can be skipped if you run the **gen-k8s-env-aks.ps1** script to automatically create the Azure environment needed for the Kubernetes deployment. That includes the AKS cluster and optionally the ARC container registry.
For example just by running the following cli script it would create to create the AKS cluster.
**Important**: Note the parameter "-createAcr true". If you are creating the K8s cluster but you want to re-use and existing ACR, say "-createAcr false".
>```
>./gen-k8s-env-aks -resourceGroupName k8sGroup -location westeurope -registryName k8sregistry -dnsName k8s-dns -serviceName k8s-cluster -createAcr true -nodeCount 3 -nodeVMSize Standard_D2_v2
>```