Watch
0
0
Fork
You've already forked hyperhive
0

k8s: the queue's client port is a loadbalancer service

The queue's client port was a hostPort on 0.0.0.0, which Pod Security baseline and restricted forbid. It is a LoadBalancer Service now, which k3s's service load balancer binds on every address of the node with a hostPort of its own in kube-system, so hives on other hosts keep their URL. No node port is allocated. The stt policy allows the load balancer's pods in place of the queue's, and the prune unit waits for them to go before the host unit starts. The egress published-port rule and the raw-table rules apply to the load balancer's hostPort as to the pod's.
This commit is contained in:
atlas 2026-11-23 19:09:02 +01:00 • committed by maia
commit 44aecd6368

View file

@ -29,6 +29,15 @@ let
'';
apiReady = waitFor 600 "the cluster's API" "${kubectl} get --raw /readyz >/dev/null 2>&1";
# The service load balancer binds a Service's port on the node with a
# `hostPort` in a pod of `kube-system`, which its controller deletes some time
# after the Service. The rule that forwards the port to that pod stays until
# the pod is gone, and would swallow what the host unit then listens on.
lbPodsGone =
name:
waitFor 180 "the load balancer's pods of ${name}"
"[ -z \"\$(${kubectl} --namespace kube-system get pods --selector svccontroller.k3s.cattle.io/svcname=${name},svccontroller.k3s.cattle.io/svcnamespace=${cfg.namespace} --output name)\" ]";
caFiles = lib.filterAttrs (_: path: path != null) rendered.caSources;
# The services on the cluster whose pods run in a user namespace.
@ -148,6 +157,7 @@ in
${kubectl} --namespace ${cfg.namespace} delete deployment,cronjob,serviceaccount,networkpolicy,service \
--selector=app.kubernetes.io/name=${name} \
--cascade=foreground --wait=true --timeout=180s --ignore-not-found
${lbPodsGone name}
${kubectl} --namespace kube-system delete addons.k3s.cattle.io ${name} --ignore-not-found
rm -f "$pending"
'';