K8s Learning: Redeploy — Full Teardown and Rebuild
Redeploy: Full Teardown and Rebuild
Runs all scripts in sequence — tear down, then rebuild everything from scratch.
The Script
./99_remove_from_vm.sh # tear down existing cluster
./01_init_vm.sh # install k3s fresh
./02_validate_initialization.sh # verify k3s is running
./03_get_config_to_localhost.sh # get credentials to your laptop
./04_install_cert_manager.sh # install cert-manager + ClusterIssuer
./05_build_and_push.sh # build & transfer Docker image
./06_deploy.sh # deploy app with Service + Ingress
When to Use Full Redeploy vs. Partial Update
| Scenario | What to run |
|---|---|
| Changed app code | 05 + 06 only |
| Changed deploy config | 06 only |
| Cluster is broken | redeploy.sh (everything) |
| Changed k3s version | redeploy.sh (everything) |
| Moved to a new VM | redeploy.sh (everything) |
| Changed cert-manager config | 04 + 05 + 06 |
| IP address changed | 01 (UFW) + 03 (kubeconfig) |
⚠️ Note on certificates: Full redeploy destroys TLS secrets, triggering a new cert request. Let's Encrypt rate-limits to 50 certs per domain per week. For routine updates, prefer steps 05 + 06.
Typical Workflows
Day-to-day development
./05_build_and_push.sh # rebuild with code changes
./06_deploy.sh # redeploy — cert reused, no downtime
Something went wrong
./redeploy.sh # nuclear: tear down and rebuild everything