Skip to content

Commit 4420cf4

Browse files
committed
Added new labs
1 parent 984afec commit 4420cf4

286 files changed

Lines changed: 31428 additions & 2340 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(cd /Users/nirg/repositories/KubernetesLabs/Labs/16-Affinity-Taint-Tolleration && python3 << 'EOF'\nwith open\\('README.md', 'r'\\) as f:\n content = f.read\\(\\)\n \nfence_count = content.count\\('```'\\)\nprint\\(f\"Total code fences: {fence_count}\"\\)\nprint\\(f\"Is even \\(properly paired\\): {fence_count % 2 == 0}\"\\)\n\n# Check last 80 lines for issues\nlines = content.split\\('\\\\n'\\)\nlast_80_lines = lines[-80:]\nfence_in_last_80 = ''.join\\(last_80_lines\\).count\\('```'\\)\nprint\\(f\"\\\\nCode fences in last 80 lines: {fence_in_last_80}\"\\)\nEOF)",
5+
"Bash(cd /Users/nirg/repositories/KubernetesLabs/Labs/16-Affinity-Taint-Tolleration && python3 << 'EOF'\nimport re\n\nwith open\\('README.md', 'r'\\) as f:\n lines = f.readlines\\(\\)\n\n# Get total lines\ntotal_lines = len\\(lines\\)\n# Get last 80 lines \\(from total-80 to total\\)\nstart_idx = max\\(0, total_lines - 80\\)\nlast_80 = lines[start_idx:]\nlast_80_content = ''.join\\(last_80\\)\n\nprint\\(f\"File has {total_lines} total lines\"\\)\nprint\\(f\"Checking lines {start_idx+1} to {total_lines}\"\\)\nprint\\(\"\\\\n=== Checking code fence balance in last 80 lines ===\"\\)\n\n# Count code fences in last 80\nfence_count = last_80_content.count\\('```'\\)\nprint\\(f\"Code fences in last 80 lines: {fence_count}\"\\)\nprint\\(f\"Properly paired: {fence_count % 2 == 0}\"\\)\n\n# Check for unclosed code blocks\nin_code = False\nline_num = start_idx + 1\nfor i, line in enumerate\\(last_80, start=start_idx+1\\):\n if line.startswith\\('```'\\):\n in_code = not in_code\n print\\(f\" Line {i}: Fence toggle \\(in_code={in_code}\\): {line.strip\\(\\)}\"\\)\n\nprint\\(f\"\\\\n=== Checking links ===\"\\)\n# Find all markdown links\nlinks = re.findall\\(r'\\\\[\\([^\\\\]]+\\)\\\\]\\\\\\(\\([^\\\\\\)]+\\)\\\\\\)', last_80_content\\)\nfor text, url in links:\n line_no = None\n for i, line in enumerate\\(last_80, start=start_idx+1\\):\n if text in line:\n line_no = i\n break\n print\\(f\" Line ~{line_no}: [{text}]\\({url}\\)\"\\)\n \n # Check relative links\n if url.startswith\\('../'\\):\n print\\(f\" -> Relative link, needs verification\"\\)\n elif url.startswith\\('http'\\):\n print\\(f\" -> External URL\"\\)\n\nEOF)",
6+
"Bash(cd /Users/nirg/repositories/KubernetesLabs/Labs/16-Affinity-Taint-Tolleration && python3 << 'EOF'\nimport re\n\nwith open\\('README.md', 'r'\\) as f:\n content = f.read\\(\\)\n lines = content.split\\('\\\\n'\\)\n\n# Get last 80 lines\nlast_80_lines = lines[-80:]\n\nprint\\(\"=== COMPREHENSIVE MARKDOWN ANALYSIS \\(Last 80 Lines\\) ===\\\\n\"\\)\n\n# 1. Check for unclosed bold\nbold_markers = 0\nfor line in last_80_lines:\n bold_count = line.count\\('**'\\)\n if bold_count % 2 != 0:\n print\\(f\"⚠ Odd number of ** in line: {line}\"\\)\n bold_markers += bold_count\n\nprint\\(f\"✓ Bold markers properly paired \\(total: {bold_markers}\\)\"\\)\n\n# 2. Check for unclosed inline code\ninline_code = 0\nfor line in last_80_lines:\n backtick_count = line.count\\('`'\\)\n # Account for code fences \\(```\\)\n code_fence_count = line.count\\('```'\\)\n single_backticks = backtick_count - \\(code_fence_count * 3\\)\n \n if single_backticks % 2 != 0 and '```' not in line:\n print\\(f\"⚠ Odd number of backticks in line: {line}\"\\)\n inline_code += single_backticks\n\nprint\\(f\"✓ Inline code markers balanced\"\\)\n\n# 3. Check heading levels\nfor i, line in enumerate\\(last_80_lines, start=len\\(lines\\)-80\\):\n if line.startswith\\('##'\\):\n print\\(f\"Line {i}: Heading: {line}\"\\)\n\n# 4. Check for markdown structure consistency\nprint\\(\"\\\\n=== Structure Check ===\"\\)\nprint\\(\"Last 80 lines structure:\"\\)\nsection_count = 0\nfor i, line in enumerate\\(last_80_lines, start=len\\(lines\\)-80\\):\n if line.startswith\\('##'\\):\n section_count += 1\n print\\(f\" Line {i}: Section: {line}\"\\)\n\n# 5. Check list consistency in Troubleshooting\nprint\\(\"\\\\n=== Troubleshooting Section Structure ===\"\\)\nin_troubleshooting = False\nlist_item_count = 0\nfor i, line in enumerate\\(last_80_lines, start=len\\(lines\\)-80\\):\n if '## Troubleshooting' in line:\n in_troubleshooting = True\n print\\(f\"Line {i}: Found Troubleshooting section\"\\)\n elif in_troubleshooting and line.startswith\\('## '\\):\n in_troubleshooting = False\n print\\(f\"Line {i}: End of Troubleshooting, found next section: {line}\"\\)\n break\n elif in_troubleshooting and line.startswith\\('- **'\\):\n list_item_count += 1\n print\\(f\" Line {i}: Troubleshooting item #{list_item_count}: {line[:50]}\"\\)\n\nprint\\(f\"\\\\nTotal troubleshooting items: {list_item_count}\"\\)\n\nEOF)"
7+
]
8+
}
9+
}

CLAUDE.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
KubernetesLabs is a hands-on Kubernetes learning repository with 33+ numbered labs and 7 task collections. Content is published as an MkDocs Material site at https://nirgeier.github.io/KubernetesLabs/.
8+
9+
## Build & Serve Commands
10+
11+
```bash
12+
# Install dependencies
13+
pip install -r mkdocs/requirements.txt
14+
15+
# Local development server (http://localhost:8000)
16+
mkdocs serve --config-file mkdocs.yml
17+
18+
# Build static site (output: mkdocs-site/)
19+
mkdocs build --config-file mkdocs.yml
20+
21+
# Deploy to GitHub Pages (done automatically by CI on push to main/master)
22+
mkdocs gh-deploy --force --clean --config-file mkdocs.yml --no-history
23+
```
24+
25+
## Architecture
26+
27+
### MkDocs Configuration
28+
29+
The single `mkdocs.yml` at root is a merged file containing all config sections. The modular source files live in `mkdocs/`:
30+
31+
- `01-mkdocs-site.yml` - Site metadata (name, URL, author)
32+
- `02-mkdocs-theme.yml` - Material theme settings
33+
- `03-mkdocs-extra.yml` - Social links, extra CSS/JS
34+
- `04-mkdocs-plugins.yml` - Plugins (git-committers, search, minify, print-site, include-markdown)
35+
- `05-mkdocs-extensions.yml` - Markdown extensions (pymdownx, mermaid, admonitions, tabs)
36+
- `06-mkdocs-nav.yml` - Navigation structure
37+
38+
**Important:** `docs_dir` is set to `Labs` - all content lives under `Labs/`.
39+
40+
### Lab Structure
41+
42+
Each lab follows this pattern:
43+
```
44+
Labs/XX-TopicName/
45+
├── README.md # Main lab content (this is the MkDocs page)
46+
├── manifests/ # Kubernetes YAML files
47+
├── scripts/ # Shell automation scripts
48+
└── [Dockerfile, etc.]
49+
```
50+
51+
Tasks live in `Labs/Tasks/Kubernetes-*-Tasks/README.md`.
52+
53+
### Navigation
54+
55+
When adding a new lab, update the nav in both:
56+
- `mkdocs.yml` (the merged config)
57+
- `mkdocs/06-mkdocs-nav.yml` (the source file)
58+
59+
## Lab README Conventions
60+
61+
- Start with optional YAML frontmatter
62+
- Include sections: description, "What will we learn?", "Official Documentation & References" (table format), "Prerequisites", then numbered content sections (01, 01.01, etc.)
63+
- Use `=== "macOS"` / `=== "Linux"` tab syntax for platform-specific instructions
64+
- Use admonitions (`!!! note`, `!!! warning`, `!!! tip`) for callouts
65+
- Use mermaid fenced blocks for architecture diagrams
66+
- Code blocks use language hints: `bash`, `yaml`, `go`, `dockerfile`
67+
68+
## CI/CD
69+
70+
GitHub Actions (`.github/workflows/deploy-mkdocs.yml`) deploys on push to `main` or `master`. Requires Python 3.11, full git history (`fetch-depth: 0`), and `mkdocs/requirements.txt`.
71+
72+
## Commit Message Convention
73+
74+
Follow the pattern: `labXX: <description>` (e.g., `lab32: Add EFK stack`).

Labs/00-VerifyCluster/README.md

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
1-
### 01. Installing Kind
1+
---
22

3-
- If you don't have an existing cluster you can use google cloud for the labs hands-on
4-
- Click on the button below to be able to run the labs on Google Shell <br/>
5-
**[Use: <kbd>CTRL + click to open in new window]**
3+
# Verify Cluster
4+
5+
- In this lab we will set up a local Kubernetes cluster using `Kind` and verify that it is working correctly.
6+
- By the end of this lab you will have a running Kubernetes cluster and confirmed connectivity.
7+
8+
---
9+
10+
## What will we learn?
11+
12+
- How to install `Kind` (Kubernetes in Docker)
13+
- How to create a local Kubernetes cluster
14+
- How to verify cluster connectivity using `kubectl`
15+
16+
---
17+
18+
## Prerequisites
19+
20+
- Docker installed and running
21+
- `kubectl` installed
22+
23+
---
24+
25+
## 01. Install Kind
26+
27+
- If you don't have an existing cluster you can use Google Cloud for the labs hands-on.
28+
- Click on the button below to be able to run the labs on Google Shell:
29+
30+
**[Use: <kbd>CTRL + click to open in new window]**
631

732
[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://console.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://github.com/nirgeier/KubernetesLabs)
833

@@ -13,7 +38,7 @@
1338
```bash
1439
# Install Kind using Homebrew
1540
brew install kind
16-
41+
1742
# Verify installation
1843
kind version
1944
```
@@ -25,7 +50,7 @@
2550
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
2651
chmod +x ./kind
2752
sudo mv ./kind /usr/local/bin/kind
28-
53+
2954
# Verify installation
3055
kind version
3156
```
@@ -37,7 +62,7 @@
3762
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
3863
chmod +x ./kind
3964
sudo mv ./kind /usr/local/bin/kind
40-
65+
4166
# Verify installation
4267
kind version
4368
```
@@ -46,7 +71,9 @@
4671

4772
Download Kind from: [https://kind.sigs.k8s.io/dl/v0.20.0/kind-windows-amd64](https://kind.sigs.k8s.io/dl/v0.20.0/kind-windows-amd64)
4873

49-
### 02. Create Kind cluster
74+
---
75+
76+
## 02. Create a Kind Cluster
5077

5178
```sh
5279
kind create cluster
@@ -70,7 +97,9 @@ kubectl cluster-info --context kind-kind
7097
Thanks for using kind! 😊
7198
```
7299

73-
### 03. Check the Kind cluster status
100+
---
101+
102+
## 03. Check the Cluster Status
74103

75104
```sh
76105
kubectl cluster-info
@@ -85,13 +114,15 @@ CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/servi
85114
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
86115
```
87116

88-
### 04. Verify that the cluster is up and running
117+
---
118+
119+
## 04. Verify the Cluster is Up and Running
89120

90121
```sh
91122
kubectl cluster-info
92123
```
93124

94-
- Verify that `kubectl` is installed and configured
125+
- Verify that `kubectl` is installed and configured:
95126

96127
```sh
97128
kubectl config view
@@ -120,7 +151,9 @@ users:
120151
client-key-data: REDACTED
121152
```
122153
123-
### 05. Verify that you can "talk" to your cluster
154+
---
155+
156+
## 05. Verify That You Can Talk to Your Cluster
124157
125158
```sh
126159
# Check the nodes in the Kind cluster

Labs/01-Namespace/README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,51 @@
1010

1111
---
1212

13+
## What will we learn?
1314

14-
### 01. Create Namespace
15+
- How to create a Kubernetes `namespace`
16+
- How to set a default `namespace` for `kubectl`
17+
- How to verify the current namespace configuration
18+
- How to use the `-n` flag to target specific namespaces
19+
20+
---
21+
22+
## Prerequisites
23+
24+
- A running Kubernetes cluster (`kubectl cluster-info` should work)
25+
- `kubectl` configured against the cluster
26+
27+
---
28+
29+
## 01. Create Namespace
1530

1631
```sh
1732
# In this sample `codewizard` is the desired namespace
18-
$ kubectl create namespace codewizard
33+
kubectl create namespace codewizard
1934
namespace/codewizard created
2035

2136
### !!! Try to create the following namespace (with _ & -), and see what happens:
22-
$ kubectl create namespace my_namespace-
37+
kubectl create namespace my_namespace-
2338
```
2439

2540
---
2641

27-
### 02. Setting the default Namespace for `kubectl`
42+
## 02. Setting the Default Namespace for `kubectl`
2843

2944
- To set the default namespace run:
3045

3146
```sh
32-
$ kubectl config set-context $(kubectl config current-context) --namespace=codewizard
47+
kubectl config set-context $(kubectl config current-context) --namespace=codewizard
3348

3449
Context minikube modified.
3550
```
3651

3752
---
3853

39-
### 03. Verify that you've updated the namespace
54+
## 03. Verify That You've Updated the Namespace
4055

4156
```sh
42-
$ kubectl config get-contexts
57+
kubectl config get-contexts
4358
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
4459
docker-desktop docker-desktop docker-desktop
4560
docker-for-desktop docker-desktop docker-desktop
@@ -48,12 +63,12 @@ CURRENT NAME CLUSTER AUTHINFO NAMESPACE
4863

4964
---
5065

51-
### 0.4 Using the `-n` Flag:
66+
## 04. Using the `-n` Flag
5267

5368
- When using `kubectl` you can pass the `-n` flag in order to execute the `kubectl` command on a desired `namespace`.
5469
- For example:
5570

5671
```sh
57-
# get resources of a specific workspace
58-
$ kubectl get pods -n <namespace>
72+
# get resources of a specific namespace
73+
kubectl get pods -n <namespace>
5974
```

0 commit comments

Comments
 (0)