Setting up Jenkins X on Azure Kubernetes Service (AKS)
WRITTEN BY
/en-us/opensource/blog/author/pui-chee-chan
As adoption of containers grows, we are getting more asks around running Jenkins on Azure Kubernetes Service (AKS.) To run Jenkins on a VM on Azure, you can use our solution template in Azure Marketplace. If you want to run Jenkins on AKS, I am happy to announce that you can now consider Jenkins X on AKS.
AKS is a fully managed Kubernetes container orchestration service that simplifies deployment and operation. With dynamic scaling of your application infrastructure, you get the confidence and agility you need without investing in a whole team to manage your Kubernetes cluster.
Jenkins X is a Jenkins subproject. It’s Jenkins on Kubernetes – an opinionated CI/CD solution for modern cloud applications. Jenkins X helps by giving you:
- Automated CI and CD – default configuration for build agents and pipelines are automatically created; you don’t need to have deep Jenkins knowledge
- Environment promotion – management of environments and promotion of new versions are automated via GitOps
- Preview environments – you get faster feedback before code merge to master and speed up delivery of changes
Combining the benefits of both AKS and Jenkins X, developers can truly focus on coding instead of spending time to set up their CI/CD infrastructure which could be daunting and time consuming.
Setting up Jenkins X on AKS
1. To run Jenkins X on Azure, start by getting the jx command line tool.
2. To create the AKS cluster, run:
jx create cluster aks
I prefer to create my AKS cluster separately so that it is easy for me to clean up after I am done.
Create an Azure resource group:
az group create -n yourResourceGroup -l yourRegion
Create a cluster with 6 nodes:
az aks create -g yourResourceGroup -n yourAKS --node-count 6
Install Jenkins X:
jx install
(select AKS as your provider)
In your Azure resource group, you should see your AKS cluster, as well as an Azure Container Registry for managing images for your application.
Testing a Spring Book app
1. Follow these steps to create a Spring Boot App. Run:
jx create spring -d web -d actuator
Once the git repo and webhook are created, build is triggered automatically.
jx get build logs
To get the URL, run:
jx open –env staging
jx create issue -t 'add a homepage'
In VS Code,
- Create a new branch.
- Add a home page index.html under src\main\resources\static.
- Commit your update and submit the PR.
In GitHub,
1. While the build is in progress, you can click the details link to check progress.
Cleaning up
To clean up, simply delete your Azure resource group
az group delete -y –no-wait -n yourResourceGroup
Jenkins X is evolving rapidly. The jx version I used to walk through the above is 1.3.933.
Try it out and give us feedback either via comment below or email us at Jenkins Azure Support. Let us know what additional Azure integrations you’d like to see in Jenkins X.