- Have AWS CLI and eksctl installed
- Have an AWS account with sufficient IAM permissions to create clusters, IAM roles, and EBS volumes
- Have kubectl installed and configured for Kubernetes operations
To create the EKS cluster for this lab, use the following commands:
1. Set up a directory for cluster configuration:
mkdir eksctl-argo-project
cd eksctl-argo-project
2. Verify your AWS identity:
aws sts get-caller-identity
3. Create an EKS cluster:
eksctl create cluster --name utrains-eksctl-cluster --region us-east-1 --nodegroup-name my-nodes --node-type t3.medium --nodes 2 --nodes-min 1 --nodes-max 2
4- Update the kubeconfig for the new cluster:
aws eks --region us-east-1 update-kubeconfig --name utrains-eksctl-cluster
5- Verify Cluster Nodes:
kubectl get nodes
# install ArgoCD in k8s cluster
# create a namespace for argo CD
kubectl create namespace argocd
# install argo CD on the created namespace
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# check the pods created
kubectl get pods -n argocd
# check the services
kubectl get svc -n argocd
# Change the argocd-server service type to LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
# Show services and Copy the dns name of Loadbalancer from argocd-server service
kubectl get svc -n argocd
# get the password to connect to the admin account
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
# Connect on the Argo UI with username: admin and the password generated by the below command
# you can change and delete init password
- Clone the git repository:
git clone https://github.com/utrains/argocd-app-config.git
- Create the application by applying the application.yaml file in argocd namespace:
kubectl apply -f application.yaml -n argocd
- Open the Argo CD UI to see all the resources. Navigate through them to see their specifications.
Make the following actions on the deployment file to see how Argo CD update the deployment to match the repo state:
- Change the deployment name
- Change the container image to nginx:stable-alpine-perl
- change the number of replicas to 4
- Modify the service name
After successfully done this lab, you must delete all the resources created to avoid charges:
1. Delete the Argo CD application:
kubectl delete -f application.yaml -n argocd
2. Delete all resources inside argocd namespace:
kubectl delete all --all -n argocd
3. Delete argocd and myapp namespaces:
kubectl delete namespace argocd
kubectl delete namespace myapp
4. Delete the EKS cluster:
eksctl delete cluster --name utrains-eksctl-cluster