Repository navigation
Add container cluster start and stop - #2485
adityaramani wants to merge 1 commit into
Conversation
cluster stop stops the nodes of a cluster: workers in parallel, then the control plane. It takes --name, --signal and --time (default 30 seconds). Disks and the kubeconfig entry are kept. cluster start boots the stopped nodes of a stopped or degraded cluster from its stored configuration and returns when the cluster is usable. It is a no-op on a running cluster. It builds a ClusterBootstrapper from the stored ClusterConfiguration (ClusterBootstrapper.init(configuration: containerSystemConfig:)) and runs ClusterBootstrapper.start, with the same progress bar pattern as create. Node IPs change when a node restarts, so workers join through a stable control-plane endpoint: the fqdn when the cluster has one, otherwise the cluster name. Without an fqdn, the control-plane address is written to each worker's /etc/hosts at create and on every start. The endpoint is added to NO_PROXY on the nodes. Workers that are still running when the control plane restarts are stopped and started again to pick up the new address. start waits for: - a fresh Lease renewal from every node it boots, because the Ready conditions stored in etcd are stale after a restart; - the kubernetes Endpoints to list only the current control-plane address and the CoreDNS pods to be Ready; - on multi-node clusters with the default CNI, a route from every node to every other node's pod network, which kindnet restores about 30 seconds after boot. NodeProvisioner gains reapplyNetworkSettings (sysctls and iptables rules that a reboot clears; iptables now uses -w) and setControlPlaneHost. start checks the host store socket and the virtiofs mount sources before booting any node and refreshes the kubeconfig, warning instead of failing if that step fails. Clusters created before this change have no controlPlaneEndpoint and cannot restart multi-node. createCluster, preparePodImage and waitForPod moved verbatim from TestClusterNetworkingSerial.swift to ContainerFixture+ClusterHelpers.swift as ContainerFixture methods. Integration tests cover single-node and multi-node stop/start and start on a running cluster. Unit tests cover node selection, leases, DNS and route readiness, proxy env, the control-plane endpoint and the CNI helpers.
Code Coverage
|
|
Tested on an M5 Max (macOS 27.2.1), release build of main + this PR (+ #1740, #2378).
Only with two or more workers, where |
|
Root cause of the 1 + 2 crash: |
|
I tested stop/start at 983d408 on a 1 + 1 cluster, with and without a DNS domain. Full stop/start and the degraded cases (control plane down with the worker running, worker down only) all came back healthy. One question about a start that fails part-way.
What I saw, on a cluster without a DNS domain:
I forced this by killing the CLI. The crash reported above stops at the same point, and from reading the code a timeout in any of the waits would leave the same state. The docs cover the recovery ( Would it make sense for |
Closes #2440
The change adds to new sub-commands to the
clustercommand familycluster stopstops the nodes of a cluster. Disks and the kubeconfig entry are kept.cluster startboots the stopped nodes of a stopped or degraded cluster from its stored configuration and returns when the cluster is usable. It is a no-op on a running cluster.Node IPs change when a node restarts, so workers join through a stable control-plane endpoint:
start waits for:
Type of Change
Motivation and Context
Implement #2440
Testing