Deployment of Java application through Azure Devops Pipeline, Azure Repos, ACR, Azure Kubentes Service
We have deployed banking application in capstone project1 using jenkins, github, dockerhub, ansible, kubernetes, we will take the same application and deploy through Azure Devops, Azure Repos, Azure container registry, Azure Kubentes Service.
We will create a new project in Azure DevOps and then go to Repo and click on Import a Repository
We have already created gihub repo for the capstone1 project: https://github.com/kotianrakshith/CapstoneProject1
We will import this:
We can see after the import all the files are imported:
(Later we will delete all the files not needed ex. Jenkinsfile.)
We wiill go to pipeline and create a new pipeline:
In the first step we will chose repo as Azure Repos Git and then our repo:
Then we will chose maven and only chose package:
Then we will have our pipeline code till the build .
We will change our pool to our default pool as we are using our local machine to build(not yet authorized to use microsoft hosted agent)
Then we will save and run.This will be saved in the azure repo.
We see that run is completed sucessfully
First let us create a container registry:
Go to container registries in azure portal:
Click create.Give a name and other details and click review and create:
Now we will go the pipeline and add the build and push to containe registry steps:
Edit the pipeline and add the task:
We will get below code to add:
We had to install docker in the local system to run this, but once done then it runs successfully:
Then we can see in the azure container registries that docker image is pushed:
We will go to kubernetes services in Azure DevOps and click create kubernetes cluster:
We will give the required details:
In integration settings we will integrate container registry and default log analytics workspace:
You can then review and create.
Once deployment is successful you should be able to see the cluster created
We will now edit the pipeline to add the kubernetes task:
To make the pipeline reusable we will add delete action below this code:
We have added continueOnError: true so that it build can proceed even if this fails.(if there is no deployment/service it will fail)
After making few small changes in previous manifest file and the pipeline, our run was successful:
In AKS, we can go to the workloads to see our deployment:
We can see that orbitbankapp is deployed.
In Services and ingresses, we can see that service is also deployed:
In this page we can see externalIP given.
We can access to required app page in
http://20.81.109.230:8989/bank-api/swagger-ui.html
(externalip:port/pagelink)
As you can see we are able to access:
And also navigate:
That completes this project. We have used the same code from capstone1 but we have used azure tools like Azure Devops, Azure Repos, Azure container registry, Azure Kubentes Service to achive the same results much easily.