diff --git a/img/k8s/deploy_script_task.png b/img/k8s/deploy_script_task.png deleted file mode 100644 index 917625f3e..000000000 Binary files a/img/k8s/deploy_script_task.png and /dev/null differ diff --git a/README.CICD.k8s.md b/k8s/README.CICD.k8s.md similarity index 65% rename from README.CICD.k8s.md rename to k8s/README.CICD.k8s.md index 182880fc5..776987b0f 100644 --- a/README.CICD.k8s.md +++ b/k8s/README.CICD.k8s.md @@ -5,44 +5,57 @@ For k8s CI/CD pipeline delivery a series of tasks must be created in VSTS to dep * A Kubernetes cluster. Follow Azure Container Service's [walkthrough](https://docs.microsoft.com/en-us/azure/container-service/container-service-kubernetes-walkthrough) to create one. * A private Docker registry. Follow Azure Container Registry's [guide](https://docs.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal) to create one. * Optionally, previous steps can be skipped if you run gen-k8s-env.ps1 script to automatically create the azure environment needed for kubernetes deployment. Azure cli 2.0 must be previously installed [installation guide](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli). For example: + >``` >./gen-k8s-env -resourceGroupName k8sGroup -location westeurope -registryName k8sregistry -orchestratorName k8s-cluster -dnsName k8s-dns >``` * An `Azure Blob storage`. It is needed for storing the kubernetes config file used by the hosted agent to access to Kubernetes cluster. Example: - + * Upload the `kubernetes config file` to the blob storage previously created. Execute the following command which will download the config file into the directory `c:\Users\\.kube\` and then, upload it to your blob storage: + >``` >https://eshopk8s.blob.core.windows.net/k8s-config/config >``` + ## Create the VSTS tasks 1. Create a `Download File` task to download the kubernetes binary `kubectl` to the hosted agent. For example: + >``` >https://storage.googleapis.com/kubernetes-release/release/v0.0.1.7.0-alpha.0/bin/windows/386/kubectl.exe >``` - + + 2. Create a Download File task to download the kubernetes config file to the hosted agent. For example: + >``` >https://eshopk8s.blob.core.windows.net/k8s-config/config >``` - + 3. Create a powershell task to execute the k8s deployment script. For example: * Deployment script path + >``` >$(System.DefaultWorkingDirectory)/All Microservices/docker-compose/deploy.ps1 >``` -* Deployment script path arguments. Where: - - userDockerHub: indicates if Docker Hub is used instead of ACR - - deployCI: indicates that it is a CI/CD deployment - - execPath: path where the k8s binary is stored - - kubeconfigPath: path where the k8s config file is stored +* Deployment script path arguments. Use value: + >``` ->-deployCI $true -useDockerHub $true -execPath '$(System.DefaultWorkingDirectory)/' -kubeconfigPath '$(System.DefaultWorkingDirectory)/' +>-deployCI $true -execPath '$(System.DefaultWorkingDirectory)/' -kubeconfigPath '$(System.DefaultWorkingDirectory)/' -deployInfrastructure $true -imageTag dev -configFile '$(System.DefaultWorkingDirectory)/$(Build.DefinitionName)/docker-compose/conf_local.yml' >``` - + - deployCI: Must be set to `$true`. This avoids create images (always are pulled from registry) and compile bits. + - deployInfrastructure: Can be set to `$false` if don't want to deploy infrastructure containers (like Redis, rabbit, SQL,...). + - imageTag: Image tag to pull from k8s. + - configFile: Configuration file (refer to [README.k8s.md](./README.k8s.md) for more info). This file is part of the VSTS build output. + - execPath: path where the k8s binary is stored + - kubeconfigPath: path where the k8s config file is stored + + You can use additional parameters (i.e. pass registry and user/password to use custom registry instead of DockerHub. Plase, refer to [README.k8s.md](./README.k8s.md) for more info. + + diff --git a/img/k8s/blob_creation.png b/k8s/img/blob_creation.png similarity index 100% rename from img/k8s/blob_creation.png rename to k8s/img/blob_creation.png diff --git a/k8s/img/deploy_script_task.png b/k8s/img/deploy_script_task.png new file mode 100644 index 000000000..96e50d3c5 Binary files /dev/null and b/k8s/img/deploy_script_task.png differ diff --git a/img/k8s/get_kubectlbin_task.png b/k8s/img/get_kubectlbin_task.png similarity index 100% rename from img/k8s/get_kubectlbin_task.png rename to k8s/img/get_kubectlbin_task.png diff --git a/img/k8s/get_kubectlconfig_task.png b/k8s/img/get_kubectlconfig_task.png similarity index 100% rename from img/k8s/get_kubectlconfig_task.png rename to k8s/img/get_kubectlconfig_task.png diff --git a/k8s/.kube/readme.md b/k8s/readme.md similarity index 74% rename from k8s/.kube/readme.md rename to k8s/readme.md index 2018b53c4..91228c608 100644 --- a/k8s/.kube/readme.md +++ b/k8s/readme.md @@ -5,4 +5,6 @@ This folder contains files needed to **create** a ACS with Kubernetes in Azure a - `gen-k8s-env.ps1` Script to create a ACS with Kubernetes in Azure - `deploy.ps1` Script to deploy eShopOnContainers in a existing k8s -Refer to file [README.k8s.md](./README.k8s.md) for detailed information \ No newline at end of file +Refer to file [README.k8s.md](./README.k8s.md) for detailed information + +Refer to file [README.CICD.k8s.md](./README.CICD.k8s.md) for information about how to set a VSTS build for deploying on k8s \ No newline at end of file