- Update init.sh with smart checkout, patch application, sync-inventory alias, and runbook output - Rewrite bootstrap/README.md with step-by-step upgrade guide, architectural invariants, and troubleshooting - Update bootstrap/AGENTS.md with single-node operational rules and OS constraints
4.0 KiB
4.0 KiB
AGENTS.md
Note
This directory handles the bootstrapping, provisioning, and in-place upgrades of the Haumdaucher Kubernetes cluster using Kubespray.
Project Overview
- Tool: Kubespray (Ansible-based).
- Topology: Single-node cluster (
haumdaucher,136.243.23.215). The single node acts simultaneously as control plane, etcd member, and worker. - Host OS: Ubuntu 20.04.6 LTS.
- Method: The local
inventory/is the source of truth, synced into the checked-out Kubespray repository. - Idempotency & Patching: The
kubespray/directory is ephemeral and managed byinit.sh. Any essential Kubespray fixes are persisted inpatches/and applied automatically.
Architectural Invariants for Single-Node Upgrades
Important
The single-node topology imposes strict operational constraints that must be observed by all agents and operators:
- NO DRAIN / NO CORDON:
- Draining or cordoning a single-node cluster evicts all workloads with nowhere to schedule them, causing cascading failures and pending pods.
drain_nodes: false,upgrade_node_always_cordon: false, andupgrade_node_fail_if_drain_fails: falseMUST remain configured in k8s-cluster.yml.- Use the in-place upgrade mechanism:
ansible-playbook -i inventory/prod/inventory.ini -e upgrade_cluster_setup=true cluster.yml. This invokeskubeadm-upgrade.ymlwithout cordon/drain overhead.
- VERSION STRING FORMAT:
- In
inventory/prod/group_vars/k8s_cluster/k8s-cluster.yml,kube_versionmust be specified without the leadingv(e.g.,1.32.13, NOTv1.32.13), as Kubespray 2.28 interpolatesv{{ kube_version }}in download URLs and package names.
- In
- UBUNTU 20.04 OS CONSTRAINT:
- Kubespray
release-2.28is the final release line supporting Ubuntu 20.04 LTS. Upstreamrelease-2.29+ drops Ubuntu 20.04 support. Do NOT bumpVERSIONininit.shbeyondrelease-2.28until the host operating system has been upgraded to Ubuntu 22.04 or 24.04.
- Kubespray
- ETCD BACKUPS:
- Always take a manual etcd snapshot before initiating any cluster upgrade.
Workflow & Scripts
1. Source init.sh
source init.sh
Actions performed:
- Clones / checks out the Kubespray branch defined by
VERSION(release-2.28). - Applies monorepo patches in
patches/*.patch(e.g., propagating--ignore-preflight-errorsforv1beta4kubeadm configs). - Activates the
infrapuzzle-bootstrappyenv virtualenv and verifies Python requirements. - Syncs
./inventory/to./kubespray/inventory/. - Exports the
sync-inventoryalias. - Changes working directory to
./kubespray.
2. Upgrading the Single-Node Cluster (Two-Phase Decoupled Workflow)
Phase 1: Reconcile Kubespray Tooling Baseline (Keep existing k8s version)
cd kubespray
ansible-playbook -i inventory/prod/inventory.ini cluster.yml
Verification: Check node readiness and that no application pods crashed.
Phase 2: Upgrade Kubernetes Version (e.g. to 1.32.13)
- Edit
bootstrap/inventory/prod/group_vars/k8s_cluster/k8s-cluster.yml:kube_version: 1.32.13 - Re-sync inventory from
bootstrap/orbootstrap/kubespray/:sync-inventory - Run the in-place upgrade:
cd kubespray ansible-playbook -i inventory/prod/inventory.ini -e upgrade_cluster_setup=true cluster.yml - Verify the cluster:
kubectl version kubectl get nodes -o wide kubectl get pods -A | grep -v -E "Running|Completed"
Directory Structure
init.sh: The entrypoint script (sources environment, applies patches, sets up inventory).patches/: Monorepo patches applied automatically to ephemeralkubespray/.inventory/: Source of truth for cluster inventory and variables.kubespray/: (Ephemeral / Gitignored) Cloned Kubespray repository.