How to deploy docker container with azure devops in Kubernetes?

8/30/2019

I'm discovering Kubernetes and Docker. I read lot of tutorials to deploy a DotNetCore App with Azure Devops Docker container and Kubernetes.

I Restore, Build, Test, and Publish with Azure devops and i copy my output files in my docker image. By the way, I read 2 ways to do it, sometimes restore build test and publish steps are executed inside the docker image.

Here my build definition :

My Release definition :

After release, all steps are in green, and the docker image is in Azure Docker Conatiner.

But there si no pod created in kubernete dashboard

DockerFile :

FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base
WORKDIR /app
COPY /app app/
ENTRYPOINT [ "dotnet" , "WebApi.dll" ]

I don't fully understand the Pipeline for Kubernetes services, someone have more informations ?

-- TangoCharly
azure-devops
devops
docker
dockerfile
kubernetes

1 Answer

8/31/2019

well, your release step is empty. so you are instructing azure devops to do literally nothing. you need to create a deployment on kubernetes:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.7.9
        ports:
        - containerPort: 80

and then you can use release to replace image tag\version on the deployment:

kubectl set image deployment/nginx-deployment nginx=myimage:$(Build.BuildId)

how you define the tag would depend on how you tag the container when you build it.

-- 4c74356b41
Source: StackOverflow