Deploy the app to Kubernetes using ArgoCD

To allow ArgoCD to constantly monitor the spring boot app manifest and deploy the changes to Kubernetes, an ArgoCD application must be created which will fetch the code from the repository and sync the desired state and actual state of the Kubernetes cluster

argocd app create spring-boot-app --repo https://github.com/devops-maestro17/java-cicd-pipeline.git --path spring-boot-app-manifests --dest-namespace default --dest-server https://kubernetes.default.svc --directory-recurse --sync-policy automated

To get the application status

kubectl get app -n argocd
Details of the application created and its components

In order to access the application from the browser, the spring-boot-app service must be exposed.

minikube service spring-boot-app-service

This will create a http URL which can be directly accessed from the browser but before that the port forwarding must be enabled using the below command. This will allow HTTP requests on port 31812 (for example) which must also be enabled on Security Group of the EC2 instance

kubectl port-forward --address 0.0.0.0 svc/spring-boot-app-service 31812:80
Port forwarding

The application can now be accessed using http://<ip address>/<port number>

The application configuration and the deployment status can also be seen using the ArgoCD UI as shown below:

Last updated