Introduction: Gluing Kubernetes Together with Bash
Prerequisites
Why Bash?
Developer Experience and Cloud-Native
What We Are Building
How the Book Is Organized
The Entry Point: setup.sh
The Shebang Line
Delegating with exec
Kind and Local Mode
Starting datacenter.sh
Hands-On Exercises
Chapter 1 Quiz
3 attempts allowed
Safety Settings, Initialization, and Lifecycle Hooks
Global Set Options
errexit — Exit on Most Errors
errtrace — Inherit Error Traps
nounset — Disallow Unset Variables
pipefail — Capture Failures in Pipelines
xtrace — Debugging (Commented Out)
Lint Your Shell Scripts: shellcheck
Script Initialization
readonly — Immutable Variables
orig_cwd — Current Working Directory
script_path — Full Script Path
script_dir and script_name
script_params — All Arguments as a String
The Main Controller
Error Handler
Default Exit Code
Disable the Trap Inside the Handler
Disable Error Options Inside the Handler
Validate the Exit Code
Exit Handler
Putting It Together
Hands-On Exercises
Chapter 2 Quiz
3 attempts allowed
Exit Codes and Controlled Exits
The script_exit Function
Printing a Message
Adding an Exit Code
Exit Code Conventions
Bash Safety Patterns in Review
Double Square Brackets
Curly Brace Expansion
The =~ Operator and Regular Expressions
Special Positional Variables
local — Function-Scoped Variables
Updated Script
Hands-On Exercises
Chapter 3 Quiz
3 attempts allowed
Cron Mode and IO Redirection
What Cron Mode Does
File Descriptors
Redirecting for Cron Mode
Creating a Temporary File
The Redirection Chain
Updating the Error Handler
Restoring the Terminal
Diagnostic Output
Printing the Log
Updating the Exit Handler
Registering cron_init in main
Updated Script
Hands-On Exercises
Chapter 4 Quiz
3 attempts allowed
The Library Pattern: Organizing a Bash Codebase
The lib/ Directory
Loading Libraries in main
Path Resolution
source — Loading Without a Subprocess
Writing a Library File
Naming Conventions
The Dependency Graph
Two Utility Libraries Worth Knowing Now
lib/repos.sh — Repository Location
lib/superuser.sh — Privilege Escalation
Hands-On Exercises
Chapter 5 Quiz
3 attempts allowed
Terminal Colors and Logging
The Logging Library
Colour Initialization
tput — Querying Terminal Capabilities
ta_none — The Reset Escape Sequence
Foreground and Background Colors
Text Attributes
The —no-colour Branch
The log Function
verbose_print — Verbose Mode Output
Updating init
Updating main
Updating the Error Handler
Hands-On Exercises
Chapter 6 Quiz
3 attempts allowed
Validation Helpers and Binary Checks
lib/script.sh
check_binary — Required Tool Detection
check_required_binaries — System Preconditions
is_kind — Mode Detection
check_arguments — Variable Presence Validation
check_directories — Path Validation
check_files — File Presence Validation
check_repos — Repository Presence Guard
build_path — PATH Construction
Using the Helpers in the init Chain
Hands-On Exercises
Chapter 7 Quiz
3 attempts allowed
Configuration Management
The Configuration File
lib/config.sh
get_configurations — Interactive Setup
read — Capturing User Input
select — Menu-Driven Input
Writing the Configuration File
Reading Configuration in main
source — Loading Another Script’s Variables
Promoting to Read-Only Globals
Docker Network Modes
Hands-On Exercises
Chapter 8 Quiz
3 attempts allowed
Script Locking: Preventing Concurrent Runs
Why a Directory, Not a File
lock_init
Lock Types
Acquiring the Lock
Releasing the Lock
Using lock_init in main
Stale Lock Handling
Hands-On Exercises
Chapter 9 Quiz
3 attempts allowed
Complete Parameter Parsing
parse_params
The while Loop and shift
Flags vs Value Parameters
Immediate-Execute Parameters
Chainable Parameters
The cleanup Flag
Direct-Action Positional Arguments
script_usage — The Help Text
Here Documents
Connecting parse_params to main
Hands-On Exercises
Chapter 10 Quiz
3 attempts allowed
Local Mode and Kind Cluster Management
Why Kind
lib/kind.sh
start_env — Creating a Kind Cluster
kind create cluster
How Code Reaches the Cluster
stop_env — Stopping the Cluster
delete_env — Destroying the Cluster
Loading Images into Kind
No Docker Environment Switching
Hands-On Exercises
Chapter 11 Quiz
3 attempts allowed
Docker Operations
lib/docker.sh
safe_docker — The Base Wrapper
safe_docker_build — Building Images
safe_docker_run — Running Containers
Volume Mounts
Environment Variables
loading Images into Kind
Docker Compose Operations
docker_compose_up — Starting External Services
docker_compose_down — Stopping External Services
docker_cleanup — Removing Dead Containers and Images
Hands-On Exercises
Chapter 12 Quiz
3 attempts allowed
Kubernetes with kubectl
lib/kubectl.sh
safe_kubectl — The Base Wrapper
kubectl_install_resource_from_file
kubectl_install_database — PostgreSQL Setup
Waiting for Pods with kubectl wait
Executing Commands in Pods
Creating ConfigMaps Idempotently
kubectl_restart — Rolling Restart
DNS Management
Restarting All Deployments
Hands-On Exercises
Chapter 13 Quiz
3 attempts allowed
Helm: Package Management for Kubernetes
lib/helm.sh
safe_helm — The Base Wrapper
Helm Charts in k8s/
helm_install_service — Generic Service Installer
Argument Arrays Instead of eval
helm upgrade —install — Idempotent by Default
—wait — Synchronous Installation
—set — Injecting Values at Install Time
helm_install_core_service — Template-Based Services
Install Config Releases
Update Functions — In-Place Upgrades
Traefik — The Ingress Controller
Hands-On Exercises
Chapter 14 Quiz
3 attempts allowed
Building Services
The Build Pipeline
lib/build.sh
build_service — The Core Build Function
Resolving the Registry IP
Image Tagging Strategy
Build Arguments
Service Group Functions
build_images_init — The Build Dispatcher
Comma-Separated Arguments
Dynamic Function Calls
lib/install_deps.sh
Docker-Based Build Isolation
Go Module Cache
check_registry
Hands-On Exercises
Chapter 15 Quiz
3 attempts allowed
Provisions from Scratch
System Architecture
The Full Provisioning Sequence
Step by Step
Step 1 — Pull Base Images
Step 2 — Build Router
Step 3 — Create the Namespace
Step 4 — Install the Registry
Step 5 — Build All Service Images
Step 6 — Install the Database
Step 7 — Install Go Dependencies
Step 8 — Build the Frontend
Step 9 — Create Service Account
Step 10 — Start External Services
Step 11 — Configure DNS
Step 12 — Storage (Kind Mode Only)
Step 13 — Deploy Configurations
Step 14 — Deploy Application Services
Step 15 — Namespace Services
Step 16 — Configure the Registry
Step 17 — GitOps with ArgoCD (Chapter 19)
Step 18 — Metrics and Dashboards (Chapter 20)
Step 19 — Distributed Tracing (Chapter 21)
Supporting Functions
build_bff — Frontend Build
helm_install_volume — Persistent Storage
helm_install_webapp_service — Frontend Deployment
install_kubernetes_service — Registry Bootstrap
Kubernetes Cluster Parameters
Kubernetes Manifests Reference
Namespace (k8s/myapp-namespace.yaml)
Registry (k8s/registry.yaml)
PostgreSQL (k8s/postgres.yaml)
Database Auth Secret (k8s/db-auth.yaml)
Service Account (k8s/service-account.yaml)
Hands-On Exercises
What Success Looks Like
Chapter 16 Quiz
3 attempts allowed
Reload and Recovery Operations
lib/reload_services.sh
reload_services — Lightweight Service Refresh
What Reload Does
reload_services_init — The Reload Dispatcher
lib/reload_kubernetes.sh
reload_all_kubernetes — Full Cluster Rebuild
Restarting the Kubernetes System Service
Deleting All Pods and Services
Nginx Configuration Update
Cleaning Up Go Package Data
Hands-On Exercises
Chapter 17 Quiz
3 attempts allowed
Teardown and Cleanup
Stopping the Environment
Deleting the Environment
Full Kubernetes Teardown
Docker Cleanup
The Exit Handler: Complete Version
Putting the Complete Script Together
The Complete main() Function
The Full init Function
The Complete Lifecycle
The Developer Experience You Built
Hands-On Exercises
Chapter 18 Quiz
3 attempts allowed
GitOps with ArgoCD
lib/argocd.sh
safe_argocd — The Base Wrapper
helm_install_argocd — Installing the Controller
Why a Dedicated Namespace
Pinning the Chart Version
NodePort for Kind
argocd_wait_ready — Confirming Startup
argocd_login — Authenticating the CLI
argocd_create_app — Registering an Application
—dest-server https://kubernetes.default.svc
—sync-policy automated
—auto-prune
—self-heal
—upsert
argocd_sync — Triggering a Sync
argocd_wait_healthy — Waiting for Sync Completion
argocd_delete_app — Removing an Application
Integrating ArgoCD into datacenter.sh
A Note on OpenShift
Hands-On Exercises
Chapter 19 Quiz
3 attempts allowed
Metrics and Dashboards with Prometheus and Grafana
lib/monitoring.sh
helm_install_monitoring — The Full Stack
Why kube-prometheus-stack
Separate Namespace for Infrastructure
Pinning the Chart Version
Default Grafana Password
monitoring_wait_ready — Confirming Startup
monitoring_port_forward — Local Access
monitoring_apply_servicemonitor — Scraping Your Services
monitoring_get_grafana_password — Credential Retrieval
Integrating Monitoring into datacenter.sh
What kube-prometheus-stack Gives You
Hands-On Exercises
Chapter 20 Quiz
3 attempts allowed
Distributed Tracing with OpenTelemetry
lib/otel.sh
safe_otel — The Base Wrapper
helm_install_otel_operator — Installing the Operator
Webhook Certificates Without cert-manager
otel_wait_ready — Confirming the Operator is Running
otel_apply_collector — Deploying the Collector
mode: deployment
processors: batch and memory_limiter
Debug Exporter
otel_apply_instrumentation — Zero-Code Auto-Instrumentation
Sampling
otel_wait_collector_ready — Confirming the Collector
Grafana Tempo — The Trace Backend
Integrating OTel into datacenter.sh
Connecting Traces, Metrics, and Logs
Hands-On Exercises
Chapter 21 Quiz
3 attempts allowed
Final Exam
Final Exam
2 attempts allowed
Appendix: datacenter.sh Command Reference
setup.sh
datacenter.sh
Global Flags
Installation
Building
Reloading
Kind Cluster (requires --kind)
Library Files
Core Libraries (Chapters 5–10)
Infrastructure Libraries (Chapters 11–18)
Observability & Delivery Libraries (Chapters 19–21)
Integration Points
Exit Codes
Chainable vs Non-Chainable Parameters
Common Workflows
Troubleshooting
“Missing dependency: Couldn’t locate X”
“Unable to acquire script lock”
“Kind cluster already exists”
“connection refused” from kubectl
PostgreSQL pod stuck in “Pending”
Helm release in “failed” state
Docker build fails with “no such file or directory”
“Refusing to delete unexpected path”
General diagnostic steps
Glossary
Kubernetes for All: The Course
Provision, deploy and operate a full Kubernetes platform from scratch with one well-built Bash script.
Build a Kubernetes platform from scratch, one Bash script at a time. Each chapter ends with a quiz, and a final exam earns you a certificate.
Minimum price
$149
$149
You pay
Author earns
About
About the Course
Kubernetes for All
Provision, deploy and operate a full Kubernetes platform from scratch with one well-built Bash script.
What You'll Learn
✔ Structure a production-grade Bash codebase: safety settings, exit codes, locking, logging and config
✔ Create and manage local kind clusters
✔ Build images and run Docker operations
✔ Deploy with kubectl and package with Helm
✔ Provision, reload, recover and tear down a whole platform
✔ Run GitOps with ArgoCD
✔ Add metrics and dashboards with Prometheus and Grafana
✔ Trace requests with OpenTelemetry
Who Is This Course For?
Developers, DevOps and platform engineers, and students who want to understand Kubernetes by building and operating a real environment end to end.
Prerequisites
Comfort with a terminal and basic shell commands. Docker installed locally. No prior Kubernetes experience required.
Why This Course?
Instead of isolated snippets, you follow one complete datacenter.sh tool from first line to GitOps and observability, so every concept lands in working code.
How It Works
- 21 chapters, each ending with a 5-question multiple-choice quiz (3 attempts, best score counts)
- A 20-question final exam covering the whole course
- 125 quiz questions in total
- Score 70% to pass; 85% or more earns honors
- Pass to receive a certificate of completion
Written by Joel Bryan Juliano.
This course is included in this track...
Instructor
About the Instructor
Hi, I'm Joel.
I am Dutch-Filipino Software Engineer with 20+ years of experience.
And with over 20 years in the game, I’ve seen it all and loved every minute of it.
My journey has taken me through a variety of industries, from sports streaming to cybersecurity, both in the private sector and for the Dutch government, and everything in between.
Along the way, I’ve picked up a diverse set of skills and experiences, in which I document into books.
Material
Course Material
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.
