We already covered how to build and push Docker image to Docker hub or azure container registry through azure DevOps build pipeline. So we have:
Let's have a look on above TODO listed points, one by one. Special thanks to Microsoft Visual Studio, who described nicely on his YouTube video.
Create deployment yaml file that required for Kubernetes deployment.
Get the quick reference from Microsoft Official for creation of deployment file. And create simple kubernetes-deployement.yml in project folder with below content:
Add some more task in Build pipeline.
Because we will be regularly using build id as version variable, so let's create a variable
Get Artifact.
And will publish changed deployment yml as artifact.
Deploy and verify pods on local Kubernetes dashboard.
Let's got to build and Queue one new build. Verify build completred.
And we are able to browse app. 🙂
Don’t forgot to verify azure subscription credit. 🤯
- GitHub repo.
- Azure devops build pipeline with Container Build and Push tasks.
- DockerHub repository. (Public)
- Kubernetes service created and running.
- Create deployment yaml file that required for Kubernetes deployment.
- Add some more task in Build pipeline.
- Get Devops artifact.
- Create a Release pipeline.
- Deploy and verify pods on local Kubernetes dashboard.
Instead of doing TODO, if you want to deploy containers manually on Kubernetes you can follow YouTube video of Houssem Dellai.
Create deployment yaml file that required for Kubernetes deployment.
Get the quick reference from Microsoft Official for creation of deployment file. And create simple kubernetes-deployement.yml in project folder with below content:
apiVersion: apps/v1beta1 kind: Deployment metadata: name: mysamplekubapps spec: replicas: 1 template: metadata: labels: app: demo-kub-apps spec: containers: - name: mssample-services-app image: rajkrs/docker_linux_redis_netcore:latest ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: demo-kub-apps spec: ports: - name: http-port port: 80 targetPort: 80 selector: app: demo-kub-apps type: LoadBalancer
Add some more task in Build pipeline.
Because we will be regularly using build id as version variable, so let's create a variable
We want to change deployment file in such a way that, for each build image rajkrs/docker_linux_redis_netcore:latest would become rajkrs/docker_linux_redis_netcore:<1.100>
So we are adding one CLI script task that will take care of latest version replacement.
Get Artifact.
And will publish changed deployment yml as artifact.
Create a Release pipeline.
We just create a release pipeline and assign the source build pipeline which we have created earlier.
To create Kubernetes service connection, click on New
Make sure in above image we have correct Manifests *.
Now we have created the release pipeline, you may enable continues deployment from Artifacts trigger option.
Deploy and verify pods on local Kubernetes dashboard.
Let's got to build and Queue one new build. Verify build completred.
Verify we have pushed tag 1.100 in Dockerhub.
Verify release pipeline is in progress..
Verify release completed successfully.
And we are able to browse app. 🙂
Don’t forgot to verify azure subscription credit. 🤯