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
ada980f35c
commit
8cd6ae3037
1 changed files with 355 additions and 103 deletions
|
|
@ -93,9 +93,9 @@ Job:
|
|||
delete. With no link, nothing went in, so the unit does nothing and needs no
|
||||
cluster.
|
||||
2. Wait for the cluster's API, then delete the service's Deployment, CronJob,
|
||||
NetworkPolicy and ServiceAccount (selected by `app.kubernetes.io/name`), and
|
||||
wait until its pods have gone. A pod exits 0 within its termination grace
|
||||
period.
|
||||
Service, NetworkPolicy and ServiceAccount (selected by
|
||||
`app.kubernetes.io/name`), and wait until its pods have gone. A pod exits 0
|
||||
within its termination grace period.
|
||||
3. Delete the cluster's AddOn for the file, so that a later switch to `"k8s"`
|
||||
applies the same manifest again. Then remove the renamed link.
|
||||
|
||||
|
|
@ -142,16 +142,24 @@ leader lock exists, so a cluster of more than one node needs one before the
|
|||
controller may move there.
|
||||
|
||||
- **The gateway's hop.** The host can't reach a unix socket inside a pod, so
|
||||
the pod serves the TCP listener, and publishes it with a `hostPort` on
|
||||
`deploy.swarm-controller.tcp.hostAddress`. That address is the hive bridge's
|
||||
by default, the one the pods already reach the host's services on. The
|
||||
the pod serves the TCP listener, and a ClusterIP Service,
|
||||
`swarm-controller.<namespace>.svc.<cluster domain>`, publishes it. The
|
||||
listener binds `0.0.0.0` inside the pod (`tcp.listenAddress`, which the
|
||||
evaluation holds there). The gateway's `/api/` and `/webhook/forge/`
|
||||
locations dial the node's address and port, and verify the listener's
|
||||
certificate as `swarm.controller.tcp.domain` (`proxy_ssl_name`,
|
||||
`proxy_ssl_verify`). With the controller on the host the locations dial the
|
||||
name. A `hostPort` reaches one node: a cluster of more than one node needs a
|
||||
Service instead.
|
||||
evaluation holds there). The host's resolver, the hive's dnsmasq, hands the
|
||||
cluster's domain to CoreDNS
|
||||
([the node](node.md#reaching-the-cluster-from-the-host)). The gateway's
|
||||
`/api/` and `/webhook/forge/` locations dial the Service's name through
|
||||
nginx's own `resolver` (the same dnsmasq) and a variable upstream, so nginx
|
||||
looks the name up per request. A name written into `proxy_pass` gets one
|
||||
lookup when nginx loads its configuration, and nginx refuses to load when it
|
||||
doesn't resolve. The locations verify the listener's certificate as
|
||||
`swarm.controller.tcp.domain` (`proxy_ssl_name`, `proxy_ssl_verify`). With
|
||||
the controller on the host the locations dial that name. The Service has a
|
||||
NetworkPolicy that selects the pod for ingress and allows nothing: the
|
||||
cluster's policy engine always admits traffic from an address of the node, so
|
||||
the gateway's connection and the kubelet's probes reach the pod, and no other
|
||||
pod does. A Service works on a cluster of more than one node, but the
|
||||
controller's Deployment still has the one replica.
|
||||
- **The listener's leaf.** The pod issues its own, from the store's
|
||||
`swarm-controller-tls` role, with the same script as
|
||||
`swarm-controller-tls.service`. An init container logs in with the pod's
|
||||
|
|
|
|||
Loading…
Reference in a new issue