# Deploying Tetris on Kubernetes with Argo CD

## **Prerequisites**

Before we begin, make sure you have the following:

1. An AWS account.
    
2. `eksctl` installed on your local machine.
    
3. `kubectl` installed on your local machine.
    
4. Git for version control.
    
5. [https://archive.eksworkshop.com/intermediate/290\_argocd/configure/](https://archive.eksworkshop.com/intermediate/290_argocd/configure/)
    

## **Step 1: Create an EKS Cluster**

Use the following `eksctl` command to create an EKS cluster named "dev" in the EU (Stockholm) region with a managed node group:

```plaintext
eksctl create cluster --name dev --region eu-north-1 --nodegroup-name workers --node-type t3.medium --nodes 2 --nodes-min 2 --nodes-max 2 --managed
```

Wait for the cluster to be provisioned before proceeding.

## **Step 2: Install Argo CD**

Create a namespace for Argo CD and apply the installation manifests:

```plaintext
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
```

Patch the Argo CD service to use a LoadBalancer:

```plaintext
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
```

Retrieve the external IP or DNS of the Argo CD server:

```plaintext
kubectl get svc argocd-server -n argocd -o=jsonpath='{.status.loadBalancer.ingress[0].hostname}'
```

Now, you can access the Argo CD UI using the provided external IP or DNS.

```plaintext
export ARGO_PWD=`kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d`
echo $ARGO_PWD
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1705312647173/249327ce-2133-4638-8782-e6865a3c1eab.png align="center")

## **Step 3: Deploy Tetris Game with Argo CD**

Clone the Tetris game repository:

```plaintext
git clone https://github.com/muhammadhassanb111/tetris-game/tree/main
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1705313305441/f211066f-a0dd-4152-a7bd-515062717800.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1705313316790/ff03a368-bcfb-47ee-8191-cf6c9dcb4c4a.png align="center")
