Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DotNetDay18: VSTS Release Pipelines with Kubernetes by Marc Müller

DotNetDay18: VSTS Release Pipelines with Kubernetes by Marc Müller

Nowadays, everybody is talking about Docker and Microservices. But how does that affect me as a developer working with the Microsoft stack? In this session Marc shows how to build an automated release pipeline using Visual Studio and VSTS which deploys ASP.NET Core Microservices into a Kubernetes infrastructure. In addition to the full developer stack needed to build the pipeline, the session covers advanced topics, such as staging environments and load-balancing.

Original Link:
https://www.slideshare.net/MarcMller/vsts-release-pipelines-with-kubernetes

dotnetday

May 29, 2018
Tweet

More Decks by dotnetday

Other Decks in Programming

Transcript

  1. ▪ Versioned artifact ▪ Isolated deployable unit ▪ Container image

    is bit by bit identical when deployed ▪ Abstraction of data center resources ▪ ▪ Orchestration is “Cattle Business” ▪ ▪
  2. Server Host OS Hypervisor Server Host OS Docker Engine Guest

    OS Guest OS Guest OS Bins/Libs Bins/Libs App A App A’ App B Bins/Libs Bins/Libs App A App A’ App B App B’ App B App B’ App B App B’ Containers are isolated, but share OS and, where appropriate, bins/libraries Bins/Libs Image Source: https://sec.ch9.ms/sessions/build/2016/B822.pptx
  3. FROM microsoft/aspnetcore:2.0 WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet",

    "a.dll"] FROM microsoft/aspnetcore:2.0 AS base WORKDIR /app EXPOSE 80 FROM microsoft/aspnetcore-build:2.0 AS build WORKDIR /src COPY *.sln ./ COPY SampleWebApplication/SampleWebApplication.csproj SampleWebApplication/ RUN dotnet restore COPY . . WORKDIR /src/SampleWebApplication RUN dotnet build -c Release -o /app FROM build AS publish RUN dotnet publish -c Release -o /app FROM base AS final WORKDIR /app COPY --from=publish /app . ENTRYPOINT ["dotnet", "SampleWebApplication.dll"]
  4. VSTS Build VSTS Release Management Docker Registry Build App Test

    Build Container Repo Container Info Publish to Target Host Container Info Push Host Pull Config Artifact
  5. ▪ ▪ Pod Container Pod Container Container 10.0.10.14 10.0.10.16 localhost

    Multi container Pods should only be used for highly coupled containers! Pod Container 10.0.10.15
  6. ▪ ▪ ▪ ▪ ▪ ▪ Service Pod Container Pod

    Container Pod Container A 1.2 A 1.2 A 1.2 A 1.2
  7. VSTS Azure Resource Group DCOS Master DCOS Master Master Agent

    VSTS Agent App1 App1 App1 App1 App1 App2 Git Build Release Internet Azure Load Balancer Ingress LeGo
  8. ### setup the cli settings kubectl config unset contexts.AKSDevFunDemo az

    account set --subscription $subscriptionname az account show # ...Register providers... ### setup kubernetes cluster az group create -n "$ressourcegroup" -l "westeurope" az aks create --resource-group $ressourcegroup --name $clustername --node-vm-size Standard_DS1_v2 --node-count 1 --generate- ssh-keys az aks get-credentials --resource-group $ressourcegroup --name $clustername az acr create --name $containerregistry --resource-group $ressourcegroup --sku Basic az acr update -n $containerregistry --admin-enabled true $acrusername = az acr credential show -n $containerregistry --query username $acrpassword = az acr credential show -n $containerregistry --query passwords[0].value ### deploy kubernetes configurations kubectl apply -f .\namespaces.yaml $dockerserver = "$($containerregistry).azurecr.io" kubectl create secret docker-registry acrauth $containerregistry --docker-username=$acrusername --docker- password=$acrpassword --docker-server="$dockerserver" --docker-email="$email" --namespace dev # ...add secrets for every namespace... helm init --upgrade --service-account default helm repo update helm install stable/nginx-ingress --namespace kube-system --set rbac.create=false --set rbac.createRole=false --set rbac.createClusterRole=false helm install stable/kube-lego --set config.LEGO_EMAIL=$email --set config.LEGO_URL=https://acme- v01.api.letsencrypt.org/directory
  9. VSTS Build Agent Build Pool Build Pool Build Pool Build

    Definition Build Definition Build Queue Docker Engine Build Agent