⎈ k8s knowledge compiler

Communication between Nodes and the Control Plane [page]deterministic

concepts

This document catalogs the communication paths between the [API server](#gloss:kube-apiserver) and the Kubernetes [cluster](#gloss:cluster). The intent is to allow users to customize their installation to harden the network configuration such that the cluster can be run on an untrusted network (or on fully public IPs on a cloud provider).

## Node to Control Plane

Kubernetes has a "hub-and-spoke" API pattern. All API usage from nodes (or the pods they run) terminates at the API server. None of the other control plane components are designed to expose remote services. The API server is configured to listen for remote connections on a secure HTTPS port (typically 443) with one or more forms of client [authentication](/docs/reference/access-authn-authz/authentication/) enabled. One or more forms of [authorization](/docs/reference/access-authn-authz/authorization/) should be enabled, especially if [anonymous requests](/docs/reference/access-authn-authz/authentication/#anonymous-requests) or [service account tokens](/docs/reference/access-authn-authz/authentication/#service-account-tokens) are allowed.

Nodes should be provisioned with the public root [certificate](#gloss:certificate) for the cluster such that they can connect securely to the API server along with valid client credentials. A good approach is that the client credentials provided to the kubelet are in the form of a client certificate. See [kubelet TLS bootstrapping](/docs/reference/access-authn-authz/kubelet-tls-bootstrapping/) for automated provisioning of kubelet client certificates.

[Pods](#gloss:pod) that wish to connect to the API server can do so securely by leveraging a service account so that Kubernetes will automatically inject the public root certificate and a valid bearer token into the pod when it is instantiated. The `kubernetes` service (in `default` namespace) is configured with a virtual IP address that is redirected (via `[kube-proxy](#gloss:kube-proxy)`) to the HTTPS endpoint on the API server.

The control plane components also communicate with the API server over the secure port.

As a result, the default operating mode for connections from the nodes and pod running on the nodes to the control plane is secured by default and can run over untrusted and/or public networks.

## Control plane to node

There are two primary communication paths from the control plane (the API server) to the nodes. The first is from the API server to the [kubelet](#gloss:kubelet) process which runs on each node in the cluster. The second is from the API server to any node, pod, or service through the API server's _proxy_ functionality.

### API server to kubelet

The connections from the API server to the kubelet are used for:

* Fetching logs for pods. * Attaching (usually through `kubectl`) to running pods. * Providing the kubelet's port-forwarding functionality.

These connections terminate at the kubelet's HTTPS endpoint. By default, the API server does not verify the kubelet's serving certificate, which makes the connection subject to man-in-the-middle attacks and unsafe to run over untrusted and/or public networks.

To verify this connection, use the `--kubelet-certificate-authority` flag to provide the API server with a root certificate bundle to use to verify the kubelet's serving certificate.

If that is not possible, use [SSH tunneling](#ssh-tunnels) between the API server and kubelet if required to avoid connecting over an untrusted or public network.

Finally, [Kubelet authentication and/or authorization](/docs/reference/access-authn-authz/kubelet-authn-authz/) should be enabled to secure the kubelet API.

### API server to nodes, pods, and services

The connections from the API server to a node, pod, or service default to plain HTTP connections and are therefore neither authenticated nor encrypted. They can be run over a secure HTTPS connection by prefixing `https:` to the node, pod, or service name in the API URL, but they will not validate the c …(trimmed)

Sources

concepts/architecture/control-plane-node-communication.md · docCommunication between Nodes and the Control Plane

Related (14)

references API serverAPI server conf=1
references Clustercluster conf=1
references Certificatecertificate conf=1
references PodPods conf=1
references kube-proxykube-proxy conf=1
references Kubeletkubelet conf=1
part_of Node to Control Planedescribes conf=1
part_of Control plane to nodedescribes conf=1
part_of {{% heading "whatsnext" %}}describes conf=1
part_of API server to kubeletdescribes conf=1
part_of API server to nodes, pods, and servicesdescribes conf=1
part_of SSH tunnelsdescribes conf=1
part_of Konnectivity servicedescribes conf=1
api_for Nodedocuments API object conf=1

← all Docs