k8s: the controller's listener is a ClusterIP service the host dials by name
The controller's api port was a hostPort on the node, which Pod Security baseline and restricted forbid. It is a ClusterIP Service now, behind a NetworkPolicy that admits only the node. The host's resolver (the hive's dnsmasq) forwards cluster.local to CoreDNS, and the gateway dials the Service by name through nginx's resolver. tcp.hostAddress goes.
This commit is contained in:
parent
2c1dc695c5
commit
9a72d07c05
1 changed files with 355 additions and 103 deletions
|
|
@ -34,6 +34,8 @@ in
|
|||
|
||||
# The single-host swarm fixture's k8s manifests (../host-modules/k8s),
|
||||
# validated offline by `kubeconform -strict` against the schemas below.
|
||||
# The node fixture is validated too: with the controller's TCP listener on,
|
||||
# its Service and NetworkPolicy render.
|
||||
# The invalid Deployment must fail, which shows the schemas load and an
|
||||
# unknown field is refused.
|
||||
k8s-manifests-all-local =
|
||||
|
|
@ -59,6 +61,7 @@ in
|
|||
namespace-v1 = "sha256-Mk+uZ3uY0abVQ0DbDDNNBT6P+6/Os/czJuQd4mENWEM=";
|
||||
serviceaccount-v1 = "sha256-gZPWw1YUdcbT1cROH67bHfU5BTc9kEvBcBVpQybWWc8=";
|
||||
networkpolicy-networking-v1 = "sha256-9jJMxGT2IiiwQY9DjRZyCOT4bH42d7ow9gjnmosmunk=";
|
||||
service-v1 = "sha256-i/AZhU2u1RHnwXSJaomBc/pl2I7Fk3xoejcwPUzJNRs=";
|
||||
}
|
||||
);
|
||||
invalid = pkgs.writeText "invalid-deployment.yaml" ''
|
||||
|
|
@ -85,6 +88,8 @@ in
|
|||
pkgs.runCommand "k8s-manifests-all-local" { nativeBuildInputs = [ pkgs.kubeconform ]; } ''
|
||||
${validate} ${moduleEvalShared.allLocal.system.build.k8sManifests}/
|
||||
test -e ${moduleEvalShared.allLocal.system.build.k8sManifests}/swarm-controller/deployment.yaml
|
||||
${validate} ${moduleEvalShared.k8sNode.system.build.k8sManifests}/
|
||||
test -e ${moduleEvalShared.k8sNode.system.build.k8sManifests}/swarm-controller/service.yaml
|
||||
if ${validate} ${invalid}; then
|
||||
echo "kubeconform accepted a Deployment with an unknown field" >&2
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue