AWS Logo
Menu
Kubernetes Isekai (異世界): Gamifying Kubernetes Education in Free AWS Academy Learner Lab

Kubernetes Isekai (異世界): Gamifying Kubernetes Education in Free AWS Academy Learner Lab

Kubernetes Isekai (異世界) is an open-source RPG that transforms Kubernetes education into an exciting adventure. Designed for students, it offers hands-on learning through interactive tasks and dynamic NPC interactions, all within the cost-effective AWS Academy Learner Lab. Dive into the world of Kubernetes with this engaging and practical educational tool!

Published Jan 24, 2025

Introduction

Kubernetes Isekai (異世界)is an open-source RPG designed for hands-on Kubernetes learning through gamification. Ideal for junior to Higher Diploma students at Hong Kong Institute of Information Technology (HKIIT), it transforms Kubernetes education into an engaging adventure.
1. Role-Playing Adventure: Students interact with NPCs who assign Kubernetes tasks.
2. Task-Based Learning: Tasks involve setting up and managing Kubernetes clusters.
3. Free Access: Uses AWS Academy Learner Lab with Minikube or Kubernetes.
4. Scalable Grading: AWS SAM application tests Kubernetes setups within AWS Lambda.
5. Progress Tracking: Students track progress and earn rewards.
This game offers practical Kubernetes experience in a fun, cost-effective way.
6. GenAI Chat: Integrates Generative AI to make NPC interactions more dynamic and fun, enhancing the overall learning experience. (Under development)

Demo

Overview

Kubernetes Isekai Architecture
Kubernetes Isekai Architecture
The primary guideline for this project is that educators should deploy and learn Kubernetes (k8s) for free using the AWS Academy Learner Lab while keeping costs to a minimum. To achieve this, we utilize the AWS Serverless Application Model (SAM) framework and run everything, including the kubectl command, using AWS Lambda.
The project is composed of three repositories:
  1. k8s-grader: This repository includes the AWS SAM backend for Kubernetes Isekai (異世界). It can be deployed to the AWS Academy Learner Lab, allowing educators and students to explore and learn Kubernetes for free. The deployment will be in the teacher's AWS account. Additionally, it contains the CloudFormation template to create Amazon EC2 instances with Minikube for each student's AWS account.
  2. k8s-game-rule: This repository includes unit tests, game instructions, and test code for the students' Kubernetes environments.
  3. k8s-isekai: This repository hosts a web game created with RPG Maker and the game site is hosted on GitHub Pages.

How does it work?

Game Task Lifecycle

Kubernetes Isekai Game Task Lifecycle
Kubernetes Isekai Game Task Lifecycle
k8s-game-rule repository contains a set of unit tests, structured with the following phases:
  1. Setup: Create the necessary Kubernetes entities as the initial checkpoint for the task, guided by instruction.md.
  2. Ready: Verify and ensure the completion of the setup phase. (Optional)
  3. Answer: Provide the solution for the task, intended for test development, but it will never be executed within the k8s-grader.
  4. Challenge: Apply load or trigger events in Kubernetes. (Optional)
  5. Check: Verify that the Kubernetes configuration or values match the expected results.
  6. Cleanup: Restore the Kubernetes environment to its state before the setup phase.
The overall design ensures that tasks can be completed independently or in sequence with task dependencies. Additionally, teachers can create debugging tasks for students by deploying bugs and having students fix them, utilizing the Challenge phase to test scaling strategies.
To prevent students from copying answers, each student receives a unique set of session objects, generating different task instructions for each student.
Game Rule Unit Test Structure
Game Rule Unit Test Structure
Game level session game01/session.json
Task level session game01/02_create_namespace/session.json
game01/02_create_namespace/instruction.md
game01/02_create_namespace/answer.template.yaml
We utilize Jinja2 to render the instructions, answers, and tests. The session at the task level will override the session at the task level. In this example, the namespace contains a random number between 1 and 10.
game01/02_create_namespace/test_05_check.py
We have the option to use either the Python Kubernetes library or the kubectl command for testing.

Keygen Lambda Function

The Keygen Lambda function is designed to generate and manage API keys for users. It validates the provided secret and email, retrieves an existing API key or creates a new one, associates the API key with a specific usage plan, and returns the API key value to the user. This function includes methods for interacting with AWS API Gateway and generating tokens.
Teachers must create individual API keys for each student. These keys are governed by a AWS API gateway usage plan that includes specific rate and usage limits.

Save k8s Lambda Function

The Save k8s Lambda function handles saving Kubernetes account information and supports both GET and POST HTTP methods. The GET method returns an HTML form for user input, while the POST method processes multipart form data to save account details. This function includes methods for reading HTML files, decoding base64-encoded data, parsing multipart form data, and validating input. It ensures that Kubernetes account information is saved accurately and efficiently.
Whenever students restart their AWS Academy Learner lab, they must re-enter their Kubernetes connection details due to the IP address of the EC2 instance changing after a stop and start. Additionally, we provide a script to download the necessary information and files.
K8s account web form
K8s account web form

Lambda Layer

Binary Lambda Layer (LibLayer) – To manage and monitor Kubernetes, we need to execute kubectl and helm commands using Python code within AWS Lambda. This layer is constructed using a Docker image, placing the necessary binaries in the directories "/opt/kubectl/" and "/opt/helm/".
The Common Layer contains Python code that is utilized by multiple Lambda functions.

Game Task Function

First, retrieve the finished tasks and decide on the current task. Next, fetch user data and Kubernetes credentials. After that, generate or retrieve the session and instructions. Finally, execute the setup game phrase tests and upload the results to an Amazon S3 bucket using a pre-signed URL. The game will display the test results if any test fails.
Due to AWS account permission limitations, we cannot use WebSocket, and the API Gateway REST API has a default time limit of 29 seconds. Here is the test code, which is the core of the game.
You can modify your game rules by using different game sources. This design separates the game rules from the grader, allowing you to create your own tests in a private repository and upload the source to a private bucket with minimal changes.
The instructions are generated using individual session data. However, since this AWS account lacks access to Amazon Bedrock, we can't utilize AI to rewrite the instructions in a more engaging and challenging way to prevent students from copying answers.
We will implement the SLM in Lambda and set up a scheduled event to pre-generate instructions for each student, as it cannot be executed within the 29-second limit.

Grader Function

It is similar to the Game Task Function, but it will not generate a new session and instruction. When the check phrase passes, it will execute the clean-up phrase and save the game task.

Further development

1. Integrate Generative AI to rewrite instructions and dialogues for each NPC.
2. Continue developing game tasks for the Certified Kubernetes Application Developer (CKAD) exam.
3. Utilize AWS Step Functions to manage the game phase cycle.
4. Establish a new brand for a fully functional AWS account. Wrap the game into an AWS Amplify application and leverage GraphQL for advanced features.
5. Build an AI agent to generate game tasks and verify them once we have sufficient sample tests for in-context learning.

Conclusion

Kubernetes Isekai (異世界) offers an innovative and engaging approach to Kubernetes education through gamification. By transforming complex Kubernetes concepts into an interactive RPG, it provides students at the Hong Kong Institute of Information Technology (HKIIT) with a hands-on, practical learning experience. The integration of AWS Academy Learner Lab ensures that this education is both accessible and cost-effective.
Key features such as role-playing adventures, task-based learning, scalable grading, and progress tracking make Kubernetes Isekai a comprehensive educational tool. The ongoing development of Generative AI for dynamic NPC interactions promises to further enhance the learning experience.
Overall, Kubernetes Isekai (異世界) stands out as a pioneering project that combines education and entertainment, preparing students for real-world Kubernetes challenges in a fun and engaging way.

Contributors

1 Comment