k8s: deny ingress to every pod by default
This commit is contained in:
parent
fbc670087a
commit
67218f4052
1 changed files with 241 additions and 27 deletions
|
|
@ -1190,6 +1190,28 @@ in
|
|||
};
|
||||
};
|
||||
}
|
||||
# Every pod of the namespace is selected for ingress and no rule admits
|
||||
# anyone, so a pod is reachable from the node alone until a policy of its own
|
||||
# admits more. The cluster's policy engine takes the union of the policies
|
||||
# that select a pod and always admits the node's own addresses, so the
|
||||
# kubelet's probes and the host's gateway still reach every pod. A port a pod
|
||||
# opens later is closed to the other pods and to the hive bridge without a
|
||||
# line here.
|
||||
// {
|
||||
"default-deny-ingress/networkpolicy" = {
|
||||
apiVersion = "networking.k8s.io/v1";
|
||||
kind = "NetworkPolicy";
|
||||
metadata = {
|
||||
name = "default-deny-ingress";
|
||||
inherit (k8sCfg) namespace;
|
||||
labels."app.kubernetes.io/part-of" = "hyperhive";
|
||||
};
|
||||
spec = {
|
||||
podSelector = { };
|
||||
policyTypes = [ "Ingress" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
// lib.concatMapAttrs (_: w: w.objects) enabled;
|
||||
|
||||
# The image each enabled service's pod runs: what the main node imports,
|
||||
|
|
|
|||
Loading…
Reference in a new issue