GitOps Fundamentals Lab
This lab teaches core GitOps principles by simulating key workflows using only Linux command-line tools. Students will:
GitOps Fundamentals Lab
This lab teaches core GitOps principles by simulating key workflows using only Linux command-line tools. Students will:
- Practice declarative configuration management
- Implement automated reconciliation
- Build self-healing systems
- Monitor state synchronization health
No Kubernetes or GitOps tools required!
Task 1: Git State Reconciliation
Objective: Simulate how GitOps operators continuously synchronize cluster state with Git
Why This Matters:
- Understand the core reconciliation loop in GitOps
- Learn why declarative configuration > imperative commands
- See how automation prevents configuration drift
Tools Used:
git | watch | diff | cp
-
Initialize repository:
mkdir gitops-lab && cd gitops-lab git init -
Create desired state:
echo "version: 1.0" > desired-state.txt git add . && git commit -m "Initial state" -
Simulate live cluster:
cp desired-state.txt current-state.txt -
Create reconciliation script:
#!/bin/bash # reconcile.sh DESIRED=$(cat desired-state.txt) CURRENT=$(cat current-state.txt) if [ "$DESIRED" != "$CURRENT" ]; then echo "$(date) - DRIFT DETECTED! Reconciling..." cp desired-state.txt current-state.txt fi -
Trigger manual drift:
echo "version: 2.0" > current-state.txt # Simulate manual cluster change -
Run reconciliation:
chmod +x reconcile.sh ./reconcile.sh # Should detect and fix drift -
Automate reconciliation:
watch -n 5 ./reconcile.sh # Runs every 5 seconds -
Documentation:
- Create a
submission7.mdfile. - Provide the output.
- Create a
Expected Output
Mon Jul 3 14:30:00 UTC 2023 - DRIFT DETECTED! Reconciling...
Task 2: GitOps Health Monitoring
Objective: Implement health checks for configuration synchronization
Why This Matters:
- Learn to validate system state consistency
- Detect configuration drift before it causes failures
- Build proactive monitoring for GitOps systems
Tools Used:
md5sum | cron | echo | date
-
Create health check script:
#!/bin/bash # healthcheck.sh DESIRED_MD5=$(md5sum desired-state.txt | awk '{print $1}') CURRENT_MD5=$(md5sum current-state.txt | awk '{print $1}') if [ "$DESIRED_MD5" != "$CURRENT_MD5" ]; then echo "$(date) - CRITICAL: State mismatch!" >> health.log else echo "$(date) - OK: States synchronized" >> health.log fi -
Make executable:
chmod +x healthcheck.sh -
Simulate healthy state:
./healthcheck.sh cat health.log# Should show "OK" -
Create drift:
echo "unapproved change" >> current-state.txt -
Run health check:
./healthcheck.sh cat health.log# Now shows "CRITICAL" -
Documentation:
- Provide the output in a
submission7.mdfile.
- Provide the output in a
Expected Output in health.log
Mon Jul 3 14:35:00 UTC 2023 - OK: States synchronized
Mon Jul 3 14:36:00 UTC 2023 - CRITICAL: State mismatch!
Lab Guidelines
- Use proper Markdown formatting and structure for the documentation files.
- Organize the files within the lab folder using appropriate naming conventions.
- Create a Pull Request to the main branch of the repository with your completed lab assignment.
-
Key Concepts Demonstrated:
Task GitOps Principle Real-World Equivalent 1 Continuous Reconciliation Argo CD/Flux sync loops 2 Health Monitoring Kubernetes operator status checks
"These simulations mirror how real GitOps operators work - just at human speed instead of computer speed!"
Related Documents
MCP Integration Workflows and Orchestration Guide
title: MCP Integration Workflows and Orchestration Guide
Valet V1 — Architecture & Implementation Plan
1. [Vision & Scope](#1-vision--scope)
Writing Effective Skills
What makes a skill actually work vs. being ignored or misapplied. Based on studying production skills across Claude Code (Superpowers, Trail of Bits, Anthropic's official plugins), Codex (babysit-pr, skill-creator, curated catalog), OpenClaw (55 bundled skills, 13,700+ community), and Cursor/Cline rule systems (BMAD-METHOD, RIPER-5, steipete/agent-rules).
Spotipy Types - Implementation Plan
A standalone type stub package for spotipy using Pydantic models generated from the official Spotify Web API OpenAPI schema.