AWS Builder Center
Deploying a Java Application to Amazon EKS with GitOps

Deploying a Java Application to Amazon EKS with GitOps

Build an end-to-end CI/CD workflow for the multi-tier vProfile application, from code quality checks and container builds to Terraform infrastructure and automated deployment to Amazon EKS with Argo CD.

AI Engineer | AWS Student Builder Group HUFLIT
In the aws-vprofile-gitops project, I built an end-to-end workflow for deploying a multi-tier Java application to Amazon Elastic Kubernetes Service (Amazon EKS). The goal was not simply to run an application on Kubernetes. I wanted a repeatable delivery process in which infrastructure is defined as code, container images are versioned, and the cluster continuously converges toward the desired state stored in Git.
This article describes the architecture, deployment workflow, and key lessons from the project.
Note: This is a hands-on learning project. Review its security, availability, and cost settings before adapting it for a production environment.

The challenge

vProfile is a Java web application that runs on Apache Tomcat and depends on three backend services:
  • MySQL for persistent data;
  • Memcached for caching;
  • RabbitMQ for messaging;
  • Tomcat for serving the web application.
With this architecture, a release involves much more than building a WAR file. I needed to check source-code quality, build and store a container image, update the deployment configuration, synchronize the Kubernetes workloads, expose the application over HTTPS, and preserve the MySQL data.
Instead of giving a single pipeline full access to the cluster, I separated the responsibilities:
  • Continuous Integration (CI) validates the code and produces the artifact;
  • Git stores the desired deployment state;
  • Argo CD provides Continuous Delivery (CD) by reconciling Git with the cluster.
This is the central idea behind the project: a production change begins with a traceable change in Git, not with a manually executed  kubectl apply  command.

Solution architecture

I divided the project into three logical areas:
Component
Responsibility
vprofile-app
Java source code, Maven configuration, Dockerfiles, and the CI workflow
vprofile-helm
Helm chart, image tags, and Argo CD manifests
vprofile-infra
Terraform for Amazon EKS, networking, IAM/OIDC, and the Amazon EBS CSI Driver
The release flow looks like this:
Developer
|
v
GitHub pull request
|
+--> Maven build and tests
+--> SonarQube analysis and Quality Gate
|
v
Merge into main
|
+--> Build the container image
+--> Push the image to Amazon ECR with a commit SHA tag
+--> Update app.tag in the Helm values file
|
v
Git repository containing the Helm chart
|
v
Argo CD detects and synchronizes the change
|
v
Amazon EKS --> ALB --> HTTPS users

Inside Amazon EKS, the Helm chart creates Deployments and Services for the application, MySQL, Memcached, and RabbitMQ. MySQL uses a PersistentVolumeClaim provisioned through the Amazon EBS CSI Driver. AWS Load Balancer Controller creates an Application Load Balancer (ALB), while a certificate in AWS Certificate Manager (ACM) secures the public endpoint with HTTPS.

Building the CI workflow with GitHub Actions

The pipeline uses pull requests as a quality-control gate. When a pull request targets the  main  branch, the workflow builds the application with Maven, runs its tests, submits the analysis to SonarQube, and waits for the Quality Gate result.
Only after the change has been reviewed and merged does the pipeline:
  1. authenticate with Amazon Elastic Container Registry (Amazon ECR);
  1. build the application image;
  1. tag and push the image using the Git commit SHA;
  1. update  app.tag  in the Helm chart's  values.yaml ;
  1. commit the deployment configuration change back to Git.
I chose the commit SHA as the image tag instead of relying only on  latest . An immutable tag answers three important questions: which version is running, which commit produced it, and which exact image should be restored during a rollback.
Sensitive values such as AWS credentials, the SonarQube token, the GitHub token, and the Slack webhook are stored in GitHub Secrets. Non-sensitive settings such as the AWS Region, ECR repository name, and SonarQube URL are stored in GitHub Variables. This separation keeps the workflow readable and reduces the risk of committing credentials to source control.

Provisioning Amazon EKS with Terraform

I defined the infrastructure with Terraform so it could be reviewed, reproduced, and removed consistently. The main components include:
  • a VPC and subnets for the cluster;
  • an Amazon EKS cluster and managed node group;
  • an OIDC provider for associating IAM roles with Kubernetes service accounts;
  • the Amazon EBS CSI Driver for persistent storage;
  • the IAM components required by the controllers.
After applying the Terraform configuration, I updated kubeconfig and verified the worker nodes before installing the platform components. AWS Load Balancer Controller uses IAM Roles for Service Accounts (IRSA), allowing it to receive only the AWS permissions it requires without storing static credentials in a pod.
Argo CD also runs inside the cluster and is exposed through an ALB. In a production environment, this administrative endpoint should be restricted by source network or protected with an appropriate authentication layer. It should not be broadly accessible simply for convenience.

Packaging the application with Helm

I converted the original Kubernetes manifests into a Helm chart. Frequently changed settings-such as images, tags, replica counts, ports, hostname, and storage size-are stored in  values.yaml , while the resource definitions remain in the  templates  directory.
Startup dependencies required special attention. The application pod needs the MySQL and Memcached service DNS records to be available before Tomcat starts. I used  initContainers  to wait for these services at the DNS level. This reduces failures caused by startup ordering, although it does not replace readiness probes or retry logic in the application itself.
Before committing a chart change, I validate the rendered resources:
helm lint helm/vprofile
helm template vprofile helm/vprofile

These two commands catch many YAML errors, missing values, and template-condition issues before Argo CD attempts a deployment.

Completing the GitOps loop with Argo CD

The Argo CD Application watches the  helm/vprofile  directory on the  main  branch. Its automated synchronization policy includes:
  •  prune: true , which removes a cluster resource after it is removed from Git;
  •  selfHeal: true , which restores the declared state after an out-of-band cluster change;
  •  CreateNamespace=true , which creates the application namespace when required.
When the CI pipeline updates the image tag, Argo CD detects the new commit, renders the Helm chart, and starts a rolling update. Kubernetes runs a new pod with the newly built image tag and replaces the previous pod after the new one becomes ready.
The complete flow is:
Code -> Quality Gate -> Container image -> Amazon ECR
-> Helm values in Git -> Argo CD -> Amazon EKS

The CI pipeline does not need to run deployment commands against the cluster. Git becomes the handoff point between CI and CD while also providing an audit trail for every release.

End-to-end validation

To validate the system, I made a small change on a feature branch, opened a pull request, and observed every control point:
  1. the Maven build and SonarQube Quality Gate completed successfully;
  1. merging the pull request created a new image in ECR with the commit SHA tag;
  1. the Helm repository received a commit that updated  app.tag ;
  1. Argo CD moved from OutOfSync to Synced;
  1. Kubernetes performed a rolling update;
  1. the application could still log in and communicate with MySQL, Memcached, and RabbitMQ;
  1. the HTTPS endpoint was served through ALB and ACM.
Checking each stage independently makes it easier to determine whether a failure belongs to CI, the registry, Git, Argo CD, or the application runtime instead of seeing only the final symptom that the application is unavailable.

Key lessons

1. Separating CI and CD reduces the permission scope

CI produces the artifact and changes the desired state in Git. Argo CD changes the cluster. Each component has a clear responsibility and a smaller permission boundary.

2. Immutable image tags provide traceability

Using the commit SHA connects the source code, container image, and running workload. A  latest  tag can still be published for convenience, but it should not be the only identifier used by a deployment.

3. Small configuration errors can break the entire delivery path

An incorrect path in an Argo CD Application, an unconfigured hostname, or a missing image tag can stop synchronization. Running  helm lint , rendering the templates locally, and reviewing manifests before applying them significantly reduces troubleshooting time.

4. GitOps does not solve every operational concern

GitOps provides strong reconciliation and auditing, but workloads still need health checks, secret management, data backups, observability, and a rollback strategy. For production, I would also consider a managed database, external secret management, monitoring, autoscaling, and separate environment configurations.

5. Cleanup is part of the architecture

ALBs and EBS volumes can continue generating costs when a cluster is deleted in the wrong order. I first remove the Ingress resources and application workloads or PVCs so the controllers can release the ALBs and EBS volumes. I then run  terraform destroy  and verify the Load Balancers, EBS Volumes, EC2 Instances, and EKS Clusters pages in the correct AWS Region.

Result

The project connects several independent tools into one delivery process. GitHub Actions validates the code and creates the image, Amazon ECR stores the artifact, Terraform reproduces the infrastructure, Helm packages the workloads, and Argo CD continuously reconciles Amazon EKS with the desired state in Git.
The most valuable result is not the number of tools involved, but the clear boundary between their responsibilities. When the source code changes, the entire journey from commit to running workload is observable, traceable, and repeatable.
Source code and workshop documentation:  github.com/KenzyTran/aws-vprofile-gitops 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article