Hey fellow gamers! Remember the excitement of 90's gaming? Let's take a trip down memory lane and relive those thrilling moments. With the game deployed on Kubernetes, it's time to dive into the nostalgic world of Mario. Grab your controllers, it's game time!
Super Mario is a classic game loved by many. In this guide, we’ll explore how to deploy a Super Mario game on Amazon’s Elastic Kubernetes Service (EKS). Utilizing Kubernetes allows us to orchestrate the game’s deployment on AWS EKS, providing scalability, reliability, and easy management.
Prerequisites:
Ubuntu Instance
IAM role
Terraform installed on the instance
AWS CLI and Kubectl on the instance
Let’s Deploy:
Step 1: Launch Ubuntu instance
Sign in to AWS Console:
- Log in to your AWS Management Console.
Navigate to EC2 Dashboard:
- Select “Services” in the top menu and choose “EC2” under the Compute section.
Launch Instance:
- Click on the “Launch Instance” button to start the instance creation process.
Choose an Amazon Machine Image (AMI):
- Select an appropriate AMI, e.g., Ubuntu.
Choose an Instance Type:
- Select t2.micro as your instance type.
Configure Instance Details:
Set the number of instances to 1.
Configure additional settings like network, subnets, IAM role, etc.
For “Storage,” add a new volume with a size of 8GB.
Add Tags (Optional):
- Add any desired tags to your instance.
Configure Security Group:
Choose an existing security group or create a new one.
Ensure the security group has the necessary inbound/outbound rules.
Review and Launch:
- Review the configuration details and launch the instance.
Select Key Pair:
- Choose an existing key pair.
Access the EC2 Instance:
- Once the instance is launched, access it using the key pair and the instance’s public IP or DNS.
Step 2: Create IAM role
Search for IAM in the AWS Console and click on roles.
Click on Create Role.
Select entity type as AWS service.
Use case as EC2 and click on Next.
For permission policy, select
Administrator Access (Just for learning purpose), and click Next.
Provide a Name for the Role and click on Create role.
Attach this role to the EC2 instance:
Go to EC2 Dashboard, select the instance.
Click on Actions –> Security –> Modify IAM role.
Select the Role created earlier and click on Update IAM role.
Step 3: Cluster provision
Clone the Repo:
https://github.com/lokeshtelange/k8s-mario.git
Change directory:
cd k8s-mario
Provide executable permission to script.sh file and run it:
sudo chmod +x script.sh ./script.sh
Check versions:
docker --version aws --version kubectl version --client terraform --version
Change directory into the EKS-TF:
cd EKS-TF terraform init
Run terraform validate and terraform plan:
terraform validate terraform plan
Run terraform apply to provision cluster:
terraform apply --auto-approve
Update the Kubernetes configuration:
aws eks update-kubeconfig --name EKS_CLOUD --region ap-south-1
Change directory back to k8s-mario:
cd ..
Apply the deployment and service:
kubectl apply -f deployment.yaml
kubectl get all
- Apply the service:
kubectl apply -f service.yaml
kubectl get all
- Describe the service and copy the LoadBalancer Ingress:
kubectl describe service mario-service
Paste the ingress link in a browser and enjoy the Mario game.
a38a084f4b0ef4c3798d047a5201e85d-240613632.ap-south-1.elb.amazonaws.com
Destruction:
Remove the service and deployment:
kubectl get all kubectl delete service mario-service kubectl delete deployment mario-deployment
Destroy the cluster:
terraform destroy --auto-approve
After 10 mins, the provisioned resources will be removed.
Thank you for joining this nostalgic journey to the 90s! We hope you enjoyed rekindling your love for gaming with the deployment of the iconic Mario game on Kubernetes. Embracing the past while exploring new technologies is a true testament to the timeless allure of classic games. Until next time, keep gaming and reliving those fantastic memories!