Practice Makes Perfect π₯·π»π
At this point, your Raspberry Pis should be configured, and you should have a
basic understanding of Kubernetes. Most importantly, you know why you're
learning all of this. Now, let's move into the practical side of things by using
kubectl (pronounced
"kube-control").
Until we start using tools like helm,
kubectl will be your best
friend. As I've mentioned before in previous sections or during my
live streams, we should add tools
and abstractions only once the work becomes repetitive and frustrating.
In this case, we aren't going to use helm until we've
learned how to use kubectl
thoroughly and memorized the key commands. Mastering the basics will help us
build a strong foundation and make it clear when it's time to introduce new
abstractions.
Learning Path Overviewβ
This practice section is organized into a progressive learning path that starts with basic Kubernetes concepts and gradually introduces the infrastructure components you'll use in production. Each exercise builds on the previous one, so it's best to follow them in order.
Prerequisitesβ
Before starting these exercises, make sure you have:
- K3s cluster running and accessible
kubectlconfigured and connected to your cluster- Basic understanding of containers and YAML
- Access to your cluster via
kubectl get nodes(should show your nodes)
How to Use This Guideβ
- Start with Beginner exercises - Even if you have some experience, these establish the foundation
- Complete exercises in order - Each builds on concepts from previous ones
- Practice both ways - Try commands first, then create YAML files
- Verify your work - Always run the verification steps
- Clean up - Remove resources after each exercise to keep your cluster clean
Practice Exercisesβ
Beginner Levelβ
Start here if you're new to Kubernetes. These exercises cover the fundamental concepts you'll use everywhere.
- Basic Kubernetes Resources - Pods, Deployments, and Services
- Namespaces and Resources - Organizing your cluster
- ConfigMaps and Secrets - Managing configuration and sensitive data
Intermediate Levelβ
Once you're comfortable with basics, these exercises introduce storage and networking concepts.
- Persistent Volumes - Understanding storage in Kubernetes
- Longhorn Storage - Using Longhorn for persistent storage
- Services and Networking - Different service types and networking patterns
Advanced Levelβ
These exercises combine everything you've learned and introduce database management and complete application stacks.
- CloudNative PG Basics - Creating and managing PostgreSQL clusters
- CloudNative PG Advanced - Database management, backups, and advanced features
- Complete Application - Full-stack application with database, storage, and services
Progression Guideβ
Level 1: Basic Kubernetes (Exercises 01-03)β
What you'll learn:
- Creating and managing Pods, Deployments, and Services
- Working with namespaces
- Managing configuration with ConfigMaps and Secrets
Infrastructure components: None yet - pure Kubernetes basics
Time estimate: 1-2 hours
Level 2: Storage and Networking (Exercises 04-06)β
What you'll learn:
- PersistentVolumeClaims and storage concepts
- Using Longhorn for distributed storage
- Different service types and networking patterns
Infrastructure components: Longhorn
Time estimate: 2-3 hours
Level 3: Databases and Advanced Topics (Exercises 07-10)β
What you'll learn:
- Managing PostgreSQL with CloudNative PG
- Database backups and recovery
- Building complete application stacks
Infrastructure components: CloudNative PG, Longhorn
Time estimate: 3-4 hours
Tips for Successβ
- Don't skip verification steps - They help you understand what's happening
- Read error messages carefully - Kubernetes error messages are usually helpful
- Use
kubectl describe- When something doesn't work, describe the resource to see what's wrong - Clean up after each exercise - Keeps your cluster manageable and helps you learn cleanup patterns
- Experiment - Once you complete an exercise, try modifying it to see what happens
Getting Helpβ
If you get stuck:
- Check the resource status:
kubectl get <resource-type> -n <namespace> - Describe the resource:
kubectl describe <resource-type> <name> -n <namespace> - Check events:
kubectl get events -n <namespace> - Review logs:
kubectl logs <pod-name> -n <namespace>
Ready to Start?β
Begin with Exercise 1: Basic Kubernetes Resources and work through the exercises in order. Remember, the goal isn't to rush through themβit's to build a solid understanding of how Kubernetes works in practice.
Good luck, and have fun! π