From 6822e2bd1ea1462a24dcc0d160e4969874dc4b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduard=20Tom=C3=A0s?= Date: Tue, 1 Aug 2017 15:01:56 +0200 Subject: [PATCH] Updated 10. Setting the solution up in ACS Kubernetes (markdown) --- 10.-Setting-the-solution-up-in-ACS-Kubernetes.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/10.-Setting-the-solution-up-in-ACS-Kubernetes.md b/10.-Setting-the-solution-up-in-ACS-Kubernetes.md index a04e2b1..57cba3c 100644 --- a/10.-Setting-the-solution-up-in-ACS-Kubernetes.md +++ b/10.-Setting-the-solution-up-in-ACS-Kubernetes.md @@ -114,11 +114,14 @@ This creates a ConfigMap named `config-files` with key `nginx-conf` whose value >``` This facilitates rapid iteration better than other techniques, e.g. building an image to bake in configuration. +Configuration of all pods is stored in a ConfigMap (named `externalcfg`) in the file `conf-local.yml`. This file contains the configuration to run k8s with "local" resources (that is, using SQL, Redis, RabbitMQ, etc, as containers in k8s). You can provide your own configuration file if you want to use external resources (i.e. if you want to use resources in Azure). The deployment script accepts the parameter `-configFile` to set which config file must be used to create the `externalcfg` ConfigMap. + The script also stores public URLs for the app's components in a ConfigMap: >`deploy.ps1` >```powershell >kubectl create configmap urls --from-literal=BasketUrl=http://$($frontendUrl)/basket-api ... >``` + >Here's how the `webspa` Deployment uses it: > >`deployments.yaml` @@ -136,6 +139,8 @@ The script also stores public URLs for the app's components in a ConfigMap: > key: BasketUrl >``` +You might wonder why `urls` ConfigMap is created by the script instead to be created from YAML file (like the `externalcfg`). This is because entries in `urls` ConfigMap depend on the public IP of the LoadBalancer service, and this IP needs to be asked. k8s do not support variables in object config files (like the YANML files used to create ConfigMaps). + ### Further reading * [Kubernetes Concepts](https://kubernetes.io/docs/concepts/) * [kubectl for Docker Users](https://kubernetes.io/docs/user-guide/docker-cli-to-kubectl/) @@ -277,11 +282,11 @@ We have simplified the deployment so you can do it just by executing a script by Once the user and password are retrieved, run the following script for deployment, including your values and password. For example: >``` ->./deploy.ps1 -registry eshopautogencontainerregistry.azurecr.io -dockerUser eShopAutogenContainerRegistry -dockerPassword YourSuperSecretPassword +>./deploy.ps1 -registry eshopautogencontainerregistry.azurecr.io -dockerUser eShopAutogenContainerRegistry -dockerPassword YourSuperSecretPassword -configFile ./conf_local.yml >``` -The script will build the .NET Core code, SPA TypeScript code and corresponding Docker images, push the latter to your registry at Azure Container Registry, and deploy the application to your cluster. +The script will build the .NET Core code, SPA TypeScript code and corresponding Docker images, push the latter to your registry at Azure Container Registry, and deploy the application to your cluster. Building .NET Core projects and/or build docker images is optionally based on parameters. ** Please refer to the file `k8s/README.k8s.md` for detailed info about how the script works and its parameters. While deploying eShopOnContainers with the script, you can see the Docker image repositories being created in your **Azure Container Registry** which happens right before deploying to Kubernetes, at the Azure's portal: