
Overview
This project showcases a custom bash script designed to automate the lifecycle of a K3s cluster, from installation to teardown. Built as part of my preparation for the 2025 Certified Kubernetes Administrator (CKA) exam, the script enables fast, repeatable cluster setups ideal for local testing, learning, and experimentation. It leverages official K3s documentation and wraps it into a clean, reusable CLI tool.
---
Challenges & Lessons Learned
- Repetitive Setup Fatigue: During intensive CKA practice, I found myself reinstalling K3s multiple times a day. Manual steps quickly became a bottleneck.
- Permission Pitfalls: Managing system permissions and cleanup between installs required careful scripting to avoid lingering artifacts.
- Need for Speed: Unlike kubeadm, K3s offered a lightweight alternative, but only if setup could be automated and error-free.
- Solution: I built a bash script that handles install, uninstall, permission fixes, and cluster verification, all in one place. It’s fast, reliable, and based on the official K3s install flow.
---
Script Highlights
- Install K3s
(following the official instructions using curl -sfL https://get.k3s.io | sh -)
- Pulls latest version from official source
- Configures systemd and permissions
- Uninstall K3s
(following the official practice using this script sudo /usr/local/bin/k3s-uninstall.sh)
- Cleans up binaries, services, and residual configs
- Reconfigure & Retry
- Ideal for rapid iteration and testing cluster behaviour
- Cluster Verification
- Includes kubectl checks to confirm node readiness
Technologies Used
- Bash scripting
- K3s (Lightweight Kubernetes)
- Systemd
- Linux CLI tooling
- GitHub for version control
Project Type
DevOps Automation / Kubernetes Tooling
Project URL
https://github.com/shubbarm/ops-scripts/tree/master/custom-k3s-opsRelated Resources / Blog Posts
Check out other projects below:
View More Projects