Skip to main content

CLI quizzes for kubectl commands and Kubernetes YAML editing

Project description

kubelingo

Kubelingo CI

kubelingo is a modular CLI package for mastering kubectl commands, Kubernetes YAML editing, and cloud-backed EKS exercises.

Features

  • Command Quiz Mode: Categorized kubectl questions with randomized order
  • YAML Editing Mode: Interactive Vim-based YAML editing with semantic validation
  • Vim Commands Quiz: Master essential Vim commands for YAML editing
  • CKAD Exam Prep: Extensive exercises covering all CKAD exam topics
  • Semantic Validation: YAML answers graded by meaning, not text matching
  • Performance Tracking: Session history and progress statistics
  • LLM Integration: Optional detailed explanations (requires OpenAI API key)

YAML Editing Mode

Practice real-world Kubernetes scenarios by editing YAML manifests in Vim with intelligent validation:

# Run interactive YAML editing exercises
kubelingo --yaml-exercises

# Set your preferred editor (default: vim)
export EDITOR=nano  # or vim, emacs, etc.
kubelingo --yaml-exercises

How YAML Editing Works

  1. Template Provided: Start with a skeleton YAML file containing TODO comments
  2. Edit in Your Editor: File opens in Vim (or your preferred $EDITOR)
  3. Semantic Validation: Your YAML is validated by meaning, not exact text match
  4. Immediate Feedback: Get specific error messages and hints for corrections
  5. Multiple Attempts: Up to 3 tries per question with helpful guidance

Validation Features

  • Syntax Checking: Catches YAML parsing errors with line numbers
  • Semantic Comparison: Compares parsed objects, not raw text
  • Field Validation: Checks required Kubernetes fields (apiVersion, kind, metadata)
  • Smart Hints: Specific guidance on what's missing or incorrect
  • Flexible Grading: Different key orders, spacing, and styles all accepted

Usage Examples

# List available categories
python3 -m kubelingo.cli --list-categories

# Standard kubectl command quiz
python3 -m kubelingo.cli -n 10 -c "Pod Management"

# Interactive YAML editing exercises (alias: --yaml-edit)
python3 -m kubelingo.cli --yaml-exercises

# Vim commands practice
python3 -m kubelingo.cli --vim-quiz

# View performance history
python3 -m kubelingo.cli --history

Question Types

Standard Questions

Traditional kubectl command questions with text-based answers.

YAML Editing Questions

Hands-on YAML editing with these fields:

  • question_type: "yaml_edit"
  • prompt: Task description
  • starting_yaml: Template with TODO comments
  • correct_yaml: Expected solution for validation
  • explanation: Learning objectives

Example:

{
  "question_type": "yaml_edit",
  "prompt": "Create a Pod named 'web-server' using nginx:1.20",
  "starting_yaml": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: # TODO\n...",
  "correct_yaml": "apiVersion: v1\nkind: Pod\nmetadata:\n  name: web-server\n...",
  "explanation": "Basic pod creation exercise"
}

Requirements

  • Python 3.8+
  • pip for installing the package (pip install -e .)
  • Vim or preferred editor (set via $EDITOR)
  • kubectl, eksctl (for command validation and cloud exercises)
  • Go and GoSandbox CLI (for cloud exercises)

CKAD Exam Coverage

Comprehensive coverage of all CKAD exam domains:

  • Core Concepts (13%): Pods, ReplicaSets, Deployments
  • Configuration (18%): ConfigMaps, Secrets, Environment Variables
  • Multi-Container Pods (10%): Sidecar, Ambassador, Adapter patterns
  • Observability (18%): Probes, Logging, Monitoring, Debugging
  • Pod Design (20%): Labels, Selectors, Annotations, Jobs, CronJobs
  • Services & Networking (13%): ClusterIP, NodePort, Ingress
  • State Persistence (8%): Volumes, PersistentVolumes, Storage Classes

File Structure

. (project root)
├── kubelingo/cli.py      # Main CLI entry point (console script: kubelingo)
├── setup.py              # Packaging and installation script
├── pyproject.toml        # Project metadata and dependencies
├── requirements.txt      # Python dependencies for development
├── LICENSE               # Project license
├── MANIFEST.in           # Package manifest
├── README.md             # Project overview and usage
├── docs/                 # Documentation (Markdown files)
└── kubelingo/            # Core application package
    ├── __init__.py
    ├── cli.py            # Main CLI implementation
    ├── data/             # Bundled quiz data (JSON)
    ├── modules/          # YAML editor and related modules
    └── tools/            # Cloud integration and session management

Creating Custom Questions

Standard Questions

{
  "prompt": "Create a pod named nginx",
  "response": "kubectl run nginx --image=nginx",
  "explanation": "Basic pod creation command"
}

YAML Editing Questions

{
  "question_type": "yaml_edit",
  "prompt": "Create a ConfigMap with database configuration",
  "starting_yaml": "apiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: # TODO\ndata:\n  # TODO",
  "correct_yaml": "apiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: db-config\ndata:\n  host: localhost\n  port: \"5432\"",
  "explanation": "ConfigMap creation with key-value data"
}

License

License: MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kubelingo-0.1.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kubelingo-0.1.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

kubelingo-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (913.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file kubelingo-0.1.0.tar.gz.

File metadata

  • Download URL: kubelingo-0.1.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for kubelingo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e2c9439036c99263663f713006ac2c5bacae66147a70a3ad80e3fa488bc3c41a
MD5 7230519ed3c25db08ce679f80c936a4d
BLAKE2b-256 08008639cca28ea936a5b2d8a84a9dfa2a9948be81b56f24f0542e1b8b988869

See more details on using hashes here.

File details

Details for the file kubelingo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kubelingo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for kubelingo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a5c71b5e263135e45cb97e994f89bcb1487943e8649c37941dbe3cb5d9c90b8
MD5 4e98bcf37d119e4508973f0d339e1f6c
BLAKE2b-256 8541c8069d4f82cd0a8d7a4657a1f1bc6799fc8d82544f94811febe07f3e653e

See more details on using hashes here.

File details

Details for the file kubelingo-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kubelingo-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16f39928e389d9da29eb1e8154a848441705c70c7247940aa93874ceececf478
MD5 1b7a5c5ce9a1c4fa70f41249568d4378
BLAKE2b-256 88279daab2da0d49b1ba8a6351d1903a223e7f0f5ca60a0d495cc929dff6ed3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page