We will learn how to automate Docker builds using Jenkins and Deploy into AWS EKS - Kubernetes Cluster.
We will use Springboot Microservices based Java application. I have already created a repo with source code + Dockerfile. The repo also have Jenkinsfile for automating the following:
- Automating Docker image creation
- Automating Docker image upload into Docker Hub
- Automating Deployments to Kubernetes Cluster
1. Amazon EKS Cluster is setup and running. Click here to learn how to create Amazon EKS cluster.
4. Docker, Docker pipeline and Kubernetes Deploy plug-ins are installed in Jenkins
Step #1 -Make sure Jenkins can run Docker builds after validating per pre-requisites
Click on Global credentials

Now Create an entry for your Docker Hub account. Make sure you enter the ID as dockerhub
Step #4 - set a clusterrole as cluster-admin
By default, clusterrolebinding has system:anonymous set which blocks the cluster access. Execute the following command to set a clusterrole as cluster-admin which will give you the required access.
Make sure you change red highlighted values below:
Your docker user id should be updated.
your registry credentials ID from Jenkins from step # 1 should be copied
node ("slave") {
def image
def mvnHome = tool 'Maven3'
stage ('checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '', url: 'https://bitbucket.org/ananthkannan/myawesomeangularapprepo/']]])
}
stage ('Build') {
sh 'mvn -f MyAwesomeApp/pom.xml clean install'
}
stage ('Docker Build') {
// Build and push image with Jenkins' docker-plugin
withDockerRegistry([credentialsId: "dockerhub", url: "https://index.docker.io/v1/"]) {
image = docker.build("akdevopscoaching/mywebapp", "MyAwesomeApp")
image.push()
}
}
stage ('K8S Deploy') {
kubernetesDeploy(
configs: 'MyAwesomeApp/springboot-lb.yaml',
kubeconfigId: 'K8S',
enableConfigSubstitution: true
)
}
}















Automating the deployment of Spring Boot microservices to Amazon EKS using Jenkins is a practical way to understand modern DevOps workflows. Integrating Jenkins pipelines with Docker and Kubernetes helps streamline application builds, container image creation, and deployments while reducing repetitive manual tasks. Understanding each stage of this process is valuable for developers who want to build and deploy scalable cloud-based applications.
ReplyDeleteFor developers interested in building full-stack applications with Spring Boot and a modern frontend framework, exploring the Spring Boot ReactJS Full Stack Online Course can complement their backend and deployment knowledge. Combining ReactJS frontend development with Spring Boot microservices provides a foundation for creating end-to-end applications that can later be containerized and deployed to cloud platforms.
Similarly, developers working with newer React-based frameworks can explore the Spring Boot NextJS Full Stack Online Course to understand how frontend and backend technologies fit together in full-stack development. Learning application architecture alongside Docker, Jenkins CI/CD pipelines, and Kubernetes deployment concepts helps connect software development with the practical steps involved in delivering applications to production.
ReplyDelete