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:
parent
e7ccc41652
commit
d93d4c07f6
1 changed files with 200 additions and 75 deletions
|
|
@ -370,11 +370,11 @@ let
|
|||
};
|
||||
|
||||
# What the policy of a pod that reaches `reaches` allows: the cluster's DNS,
|
||||
# those host ports, and the queue's own pod where the queue runs in the
|
||||
# cluster, because its `hostPort` is forwarded to the pod before the policy
|
||||
# sees the packet. The policy selects every pod of the service for ingress
|
||||
# too and allows none, so only the node's own traffic (the kubelet's probes,
|
||||
# which the policy engine always admits) reaches it.
|
||||
# those host ports, and the pods of the queue's load balancer where the queue
|
||||
# runs in the cluster, because the `hostPort` they bind is forwarded to them
|
||||
# before the policy sees the packet. The policy selects every pod of the
|
||||
# service for ingress too and allows none, so only the node's own traffic
|
||||
# (the kubelet's probes, which the policy engine always admits) reaches it.
|
||||
networkPolicyOf =
|
||||
name: reaches:
|
||||
let
|
||||
|
|
@ -416,7 +416,15 @@ let
|
|||
}
|
||||
]
|
||||
++ lib.optional (queueOnCluster && lib.elem "queue" reaches) {
|
||||
to = [ { podSelector.matchLabels = labelsFor "swarm-nats"; } ];
|
||||
to = [
|
||||
{
|
||||
namespaceSelector.matchLabels."kubernetes.io/metadata.name" = "kube-system";
|
||||
podSelector.matchLabels = {
|
||||
"svccontroller.k3s.cattle.io/svcname" = "swarm-nats";
|
||||
"svccontroller.k3s.cattle.io/svcnamespace" = k8sCfg.namespace;
|
||||
};
|
||||
}
|
||||
];
|
||||
ports = [ (tcp hostPorts.queue) ];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue