52 lines
2.7 KiB
Markdown
52 lines
2.7 KiB
Markdown
# The cluster node
|
|
|
|
`services.hyperhive.deploy.k8s.enable` (default `false`) makes the host run a
|
|
single-node k3s server for the swarm services that run in the cluster. It's
|
|
the Kubernetes counterpart of `services.hyperhive.deploy.singleHostSwarm`: set
|
|
it on the host that runs the swarm's services, and the cluster comes up with the
|
|
service images loaded and nothing applied.
|
|
|
|
## What the host gets
|
|
|
|
- **k3s:** one server, which also runs the workloads. traefik and
|
|
metrics-server are off, and the cluster encrypts its Secrets at rest
|
|
(`--secrets-encryption`). CoreDNS and the local-path provisioner stay on, so
|
|
pods have cluster DNS and PersistentVolumeClaims.
|
|
- **Images:** the node holds k3s's own images and the image of each service
|
|
that [renders manifests](manifests.md) on this host, in containerd before k3s
|
|
starts. No registry exists, and the pods name their images with
|
|
`imagePullPolicy: Never`.
|
|
- **Manifests:** `services.hyperhive.k8s.enable` is on, so the host builds
|
|
`system.build.k8sManifests` and `system.build.k8sImages`. Setting it to
|
|
`false` explicitly fails the evaluation.
|
|
- **Addresses:** pods take their addresses from `deploy.k8s.podCidr` (default
|
|
`10.200.0.0/16`) and services from `deploy.k8s.serviceCidr` (default
|
|
`10.201.0.0/16`). Neither may overlap the hive bridge's subnet
|
|
(`network.bridgeIp`, default `10.42.0.0/24`) or the other, and the
|
|
evaluation fails when one does: the bridge and the cluster would route the
|
|
same addresses. k3s's own default pod range, `10.42.0.0/16`, contains the
|
|
bridge's default subnet.
|
|
- **Firewall:** the pod network's interfaces, `cni0` and `flannel.1`, are
|
|
trusted, so the node reaches its pods.
|
|
|
|
## What it leaves alone
|
|
|
|
The cluster starts with no hyperhive workload. Each service keeps running as
|
|
its systemd unit, and nothing applies the manifests: two copies of
|
|
`swarm-notify-router`, `swarm-ci-metrics` or `swarm-controller` would share one
|
|
queue consumer, one cursor or one swarm. A service's objects go into the
|
|
cluster when that service moves in (see [`swarmctl migrate`](migrate.md)).
|
|
|
|
With the option off, the host's configuration is the one it has without the
|
|
module.
|
|
|
|
## Validation
|
|
|
|
`module-eval-k8s` compares an all-local host with the option on against the
|
|
same host with it off. The off host has no k3s, no trusted interface and no
|
|
image list; the on host adds the k3s unit and nothing else. The VM test
|
|
`k8s-node` boots a node through the module, and asserts that the node is Ready,
|
|
that containerd holds every image, that the cluster has no hyperhive
|
|
workload, and that the node and the hive bridge hold addresses from
|
|
different ranges. The module-eval also checks that overlapping ranges fail the
|
|
evaluation.
|