Keep Gitea running when stopping cluster

This commit is contained in:
juvdiaz 2026-06-27 08:26:52 -06:00
parent 09db6370b0
commit f1c405aab4
3 changed files with 22 additions and 12 deletions

View File

@ -265,14 +265,17 @@ PV data, or VM disks, run:
./lab.sh stop-cluster
```
This stops `kubelet` and `containerd` on the Debian control plane, stops any
workers listed in `WORKER_SSH_TARGETS`, and gracefully shuts down automated
Pimox worker VMs. It does not run `kubeadm reset`, delete CNI files, or remove
state. Use `LAB_CLUSTER_STOP_VM_TIMEOUT_SECONDS` to change the Pimox shutdown
timeout, `LAB_CLUSTER_STOP_FORCE=false` to avoid a hard `qm stop` after timeout,
and the usual `LAB_PIMOX_WORKER_COUNT`, `LAB_PIMOX_WORKER_BASE_VMID`, and
`LAB_PIMOX_SKIP_WORKER_INDEXES` variables to select VM workers. Resume the
runtime with:
This stops `kubelet`, stops Kubernetes CRI containers with `crictl` when
available, stops any workers listed in `WORKER_SSH_TARGETS`, and gracefully
shuts down automated Pimox worker VMs. It intentionally leaves the host
`containerd`/Docker stack running so external Docker Compose services such as
Gitea stay online. It does not run `kubeadm reset`, delete CNI files, or remove
state. Use `LAB_CLUSTER_STOP_CONTAINERD=true` only when you intentionally want
to stop the host container runtime too. Use `LAB_CLUSTER_STOP_VM_TIMEOUT_SECONDS`
to change the Pimox shutdown timeout, `LAB_CLUSTER_STOP_FORCE=false` to avoid a
hard `qm stop` after timeout, and the usual `LAB_PIMOX_WORKER_COUNT`,
`LAB_PIMOX_WORKER_BASE_VMID`, and `LAB_PIMOX_SKIP_WORKER_INDEXES` variables to
select VM workers. Resume the runtime with:
```bash
./lab.sh start-cluster

View File

@ -86,7 +86,7 @@ server {
limit_req zone=one burst=20 nodelay;
client_max_body_size 512m;
proxy_pass http://${gitea_backend_host}:${gitea_backend_port}/;
proxy_pass http://${gitea_backend_host}:${gitea_backend_port};
proxy_http_version 1.1;
proxy_request_buffering off;
proxy_read_timeout 300s;

13
lab.sh
View File

@ -3259,13 +3259,20 @@ cluster_worker_targets() {
stop_local_kubernetes_services() {
echo "--> Stopping local Kubernetes services on the Debian control plane..."
sudo systemctl stop kubelet 2>/dev/null || true
sudo systemctl stop containerd 2>/dev/null || true
sudo systemctl reset-failed kubelet containerd 2>/dev/null || true
if command -v crictl >/dev/null 2>&1; then
sudo crictl stop --all 2>/dev/null || true
fi
if truthy "${LAB_CLUSTER_STOP_CONTAINERD:-false}"; then
sudo systemctl stop containerd 2>/dev/null || true
sudo systemctl reset-failed containerd 2>/dev/null || true
fi
sudo systemctl reset-failed kubelet 2>/dev/null || true
}
start_local_kubernetes_services() {
echo "--> Starting local Kubernetes services on the Debian control plane..."
sudo systemctl start containerd
sudo systemctl start docker 2>/dev/null || true
sudo systemctl start kubelet
}
@ -3274,7 +3281,7 @@ stop_remote_kubernetes_services() {
echo "--> Stopping Kubernetes services on remote worker ${target}..."
ssh -o ConnectTimeout=5 "${target}" \
"sudo systemctl stop kubelet 2>/dev/null || true; sudo systemctl stop containerd 2>/dev/null || true; sudo systemctl reset-failed kubelet containerd 2>/dev/null || true"
"sudo systemctl stop kubelet 2>/dev/null || true; if command -v crictl >/dev/null 2>&1; then sudo crictl stop --all 2>/dev/null || true; fi; if [ '${LAB_CLUSTER_STOP_CONTAINERD:-false}' = 'true' ]; then sudo systemctl stop containerd 2>/dev/null || true; sudo systemctl reset-failed containerd 2>/dev/null || true; fi; sudo systemctl reset-failed kubelet 2>/dev/null || true"
}
start_remote_kubernetes_services() {