| Item | Purpose |
|---|---|
| AWS Account | EKS cluster hosting |
| EKS cluster | Kubernetes cluster already created (eksctl create cluster …) |
| Argo CD installed | kubectl create namespace argocd && kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml |
| Docker Hub account | To host container images |
| GitHub repository | Contains: src code, Dockerfile, deploymentfiles/deployment.yml, and workflow in .github/workflows/cicd.yml |
| Java/Maven app | Your Java code that builds a JAR/WAR |
argocd_github_actions_project/
├─ src/...
├─ Dockerfile
├─ pom.xml
└─ deploymentfiles/
└─ deployment.yml # Kubernetes Deployment + Service
In Repository → Settings → Secrets and variables → Actions → New repository secret, add:
| Secret | Example |
|---|---|
DOCKER_USERNAME |
your-dockerhub-username |
DOCKER_PASSWORD |
your-dockerhub-password |
ARGOCD_SERVER |
<LoadBalancer-IP or hostname> |
ARGOCD_PASSWORD |
Argo CD admin password |
curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version --short --client
curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
sudo mv /tmp/eksctl /usr/local/bin
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
kubectl get svc argocd-server -n argocd
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d ; echo
- Repo Settings → Actions → General → Workflow permissions
- Select “Read and write permissions” and save.
Create file: .github/workflows/cicd.yml
https://github.com/jadalaramani/argocd_github_actions_project/blob/main/.github/workflows/cicd.yaml
In the Argo CD web UI:
- + New App
- Name:
my-app - Repo URL:
https://github.com/jadalaramani/argocd_github_actions_project.git - Path:
deploymentfiles - Cluster URL:
https://kubernetes.default.svc - Namespace:
default - Create.
- Optionally set Sync Policy → Automatic so deployments happen without manual clicks.
-
Developer pushes code to main.
-
GitHub Actions:
- Builds JAR/WAR with Maven.
- Builds Docker image
ramanijadala/webapp:<run_number>. - Pushes to Docker Hub.
- Replaces
:tagindeployment.ymlwith that run number. - Commits the updated manifest back to the repository.
-
Argo CD detects the Git change and deploys the updated image to EKS.
-
Pods in EKS pull the exact image tag and run.
- GitHub Actions Logs: should show the new image tag and a successful commit.
- GitHub Repo:
deployment.ymlcontainsramanijadala/webapp:<number>. - Docker Hub: new tag appears.
- Argo CD UI: Application health = Healthy, pods running with the correct image.
- 403 push error: confirm “Read and write permissions” enabled and
GITHUB_TOKENenv is present. - ImagePullBackOff: check that
deployment.ymlreally contains the latest numeric tag and that the image exists in Docker Hub. - Namespace errors: ensure Destination namespace is
default(no spaces).