Skip to content

Commit 35befff

Browse files
authored
Merge pull request kubernetes#4089 from jkh52/knp-template
KEP-1281: update stale content.
2 parents 78f729a + d3688bc commit 35befff

File tree

1 file changed

+52
-50
lines changed
  • keps/sig-api-machinery/1281-network-proxy

1 file changed

+52
-50
lines changed

keps/sig-api-machinery/1281-network-proxy/README.md

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
- [Security](#security)
1919
- [Implementation Details/Notes/Constraints](#implementation-detailsnotesconstraints)
2020
- [User Stories](#user-stories)
21-
- [Combined Master and Node Network](#combined-master-and-node-network)
22-
- [Master and Untrusted Node Network](#master-and-untrusted-node-network)
23-
- [Master and Node Networks which are not IP Routable](#master-and-node-networks-which-are-not-ip-routable)
21+
- [Combined Control Plane and Node Network](#combined-control-plane-and-node-network)
22+
- [Control Plane and Untrusted Node Network](#control-plane-and-untrusted-node-network)
23+
- [Control Plane and Node Networks which are not IP Routable](#control-plane-and-node-networks-which-are-not-ip-routable)
2424
- [Better Monitoring](#better-monitoring)
2525
- [Design Details](#design-details)
2626
- [Risks and Mitigations](#risks-and-mitigations)
@@ -40,16 +40,16 @@ default behavior is insufficient.
4040

4141
## Motivation
4242

43-
Kubernetes has outgrown the [SSH tunnels](https://github.com/kubernetes/kubernetes/issues/54076).
44-
They complicate KAS code and only one cloud provider implemented them.
45-
After a year of deprecation time, they will be removed in an upcoming release.
43+
Historically, Kubernetes used [SSH tunnels](https://github.com/kubernetes/kubernetes/issues/54076), but they only
44+
functioned on GCE; they were deprecated in 1.9 and [removed in
45+
1.22](https://github.com/kubernetes/kubernetes/pull/102297).
4646

4747
In retrospect, having an explicit level of indirection that separates user-initiated network traffic from API
4848
server-initiated traffic is a useful concept.
4949
Cloud providers want to control how API server to pod, node and service network traffic is implemented.
5050
Cloud providers may choose to run their API server (control network) and the cluster nodes (cluster network)
5151
on isolated networks. The control and cluster networks may have overlapping IP addresses.
52-
There for they require a non IP routing layer (SSH tunnel are an example).
52+
Therefore they require a non-IP routing proxy layer (SSH tunnel are an example).
5353
Adding this layer enables metadata audit logging. It allows validation of outgoing API server connections.
5454
Structuring the API server in this way is a forcing function for keeping architectural layering violations out of apiserver.
5555
In combination with a firewall, this separation of networks protects against security concerns such as
@@ -58,32 +58,32 @@ In combination with a firewall, this separation of networks protects against sec
5858
### Goals
5959

6060
Delete the SSH Tunnel/Node Dialer code from Kube APIServer.
61-
Enable admins to fix https://groups.google.com/d/msg/kubernetes-security-announce/tyd-MVR-tY4/tyREP9-qAwAJ.
61+
Enable admins to mitigate https://groups.google.com/d/msg/kubernetes-security-announce/tyd-MVR-tY4/tyREP9-qAwAJ.
6262
Allow isolation of the Control network from the Cluster network.
6363

6464
### Non-Goals
6565

6666
Build a general purpose Proxy which does everything. (Users should build their own
67-
custom proxies with the desired behavior, based on the provided proxy)
67+
custom proxies with the desired behavior, based on the provided proxy.)
6868
Handle requests from the Cluster to the Control Plane. (The proxy can be extended to
69-
do this. However that is left to the User if they want that behavior)
69+
do this. However that is left to the User if they want that behavior.)
7070

7171
## Definitions
7272

73-
- **Master Network** An IP reachable network space which contains the master components, such as Kubernetes API Server,
73+
- **Control Plane Network** An IP reachable network space which contains the control plane components, such as Kubernetes API Server,
7474
Connectivity Proxy and ETCD server.
7575
- **Node Network** An IP reachable network space which contains all the clusters Nodes, for alpha.
76-
Worth noting that the Node Network may be completely disjoint from the Master network.
77-
It may have overlapping IP addresses to the Master Network or other means of network isolation.
78-
Direct IP routability between cluster and master networks should not be assumed.
76+
Worth noting that the Node Network may be completely disjoint from the Control Plane network.
77+
It may have overlapping IP addresses to the Control Plane Network or other means of network isolation.
78+
Direct IP routability between cluster and control plane networks should not be assumed.
7979
Later version may relax the all node requirement to some.
8080
- **KAS** Kubernetes API Server, responsible for serving the Kubernetes API to clients.
8181
- **KMS** Key Management Service, plugins for secrets encryption key management
8282
- **Egress Selector** A component built into the KAS which provides a golang dialer for outgoing connection requests.
8383
The dialer provided depends on NetworkContext information.
84-
- **Konnectivity Server** The proxy server which runs in the master network.
84+
- **Konnectivity Server** The proxy server which runs in the control plane network.
8585
It has a secure channel established to the cluster network.
86-
It could work on either a HTTP Connect mechanism or gRPC.
86+
It could work on either a gRPC or HTTP Connect mechanism.
8787
If the former it would exposes a gRPC interface to KAS to provide connectivity service.
8888
If the latter it would use standard HTTP Connect.
8989
Formerly known the the Network Proxy Server.
@@ -95,15 +95,15 @@ Implies no overlapping (i.e. shared) IPs on the network.
9595

9696
## Proposal
9797

98-
We will run a connectivity server inside the master network.
98+
We will run a connectivity server inside the control plane network.
9999
It could work on either a HTTP Connect mechanism or gRPC.
100100
For the alpha version we will attempt to get this working with HTTP Connect.
101101
We will evaluate HTTP Connect for scalability, error handling and traffic types.
102102
For scalability we will be looking at the number of required open connections.
103103
Increasing usage of webhooks means we need better than 1 request per connection (multiplexing).
104104
We also need the tunnel to be tolerant of errors in the requests it is transporting.
105105
HTTP-Connect only supports HTTP requests and not things like DNS requests.
106-
We assume that for HTTP URL request,s it will be the proxy which does the DNS lookup.
106+
We assume that for HTTP URL requests, it will be the proxy which does the DNS lookup.
107107
However this means that we cannot have the KAS perform a DNS request to then do a follow on request.
108108
If no issues are found with HTTP Connect in these areas we will proceed with it.
109109
If an issue is found then we will update the KEP and switch the client to the gRPC solution.
@@ -112,7 +112,7 @@ This should be as simple as switching the connection mode of the client code.
112112
It may be desirable to allow out of band data (metadata) to be transmitted from the KAS to the Proxy Server.
113113
We expect to handle metadata in the HTTP Connect case using http 'X' headers on the Connect request.
114114
This means that the metadata can only be sent when establishing a KAS to Proxy tunnel.
115-
For the GRPC case we just update the interface to the KAS.
115+
For the gRPC case we just update the interface to the KAS.
116116
In this case the metadata can be sent even during tunnel usage.
117117

118118
Each connectivity proxy allows secure connections to one or more cluster networks.
@@ -124,7 +124,7 @@ Running the connectivity proxy in a separate process has a few advantages.
124124
- The connectivity proxy can be extended without recompiling the KAS.
125125
Administrators can run their own variants of the connectivity proxy.
126126
- Traffic can be audited or forwarded (eg. via a proprietary VPN) using a custom connectivity proxy.
127-
- The separation removes master <-> cluster connectivity concerns from the KAS.
127+
- The separation removes control plane <-> cluster connectivity concerns from the KAS.
128128
- The code and responsibility separation lowers the complexity of the KAS code base.
129129
- The separation reduces the effects of issue such as crashes in the connectivity impacting the KAS.
130130
Connectivity issues will not stop the KAS from serving API requests.
@@ -133,13 +133,13 @@ A problem with a node, set of nodes or load-balancers configuration, may be fixe
133133

134134
![API Server Network Proxy Simple Cluster](NetworkProxySimpleCluster.png)
135135
The diagram shows API Server’s outgoing traffic flow.
136-
The user (in blue box), master network (in purple cloud) and
136+
The user (in blue box), control plane network (in purple cloud) and
137137
a cluster network (in green cloud) are represented.
138138

139139
The user (blue) initiates communication to the KAS.
140140
The KAS then initiates connections to other components.
141141
It could be node/pod/service in cluster networks (red dotted arrow to green cloud),
142-
or etcd for storage in the same master network (blue arrow) or mutate the request
142+
or etcd for storage in the same control plane network (blue arrow) or mutate the request
143143
based on an admission web-hook (red dotted arrow to purple cloud).
144144
The KAS handles these cases based on NetworkContext based traffic routing.
145145
The connectivity proxy should be able to do routing solely based on IP.
@@ -154,8 +154,8 @@ The minimal NetworkContext looks like the following struct in golang:
154154
type EgressType int
155155

156156
const (
157-
// Master is the EgressType for traffic intended to go to the control plane.
158-
Master EgressType = iota
157+
// ControlPlane is the EgressType for traffic intended to go to the control plane.
158+
ControlPlane EgressType = iota
159159
// Etcd is the EgressType for traffic intended to go to Kubernetes persistence store.
160160
Etcd
161161
// Cluster is the EgressType for traffic intended to go to the system being managed by Kubernetes.
@@ -174,12 +174,12 @@ type NetworkContext struct {
174174
EgressSelectionName specifies the network to route traffic to.
175175
The KAS starts with a list of registered konnectivity service names. These
176176
correspond to networks we route traffic to. So the KAS knows where to
177-
proxy the traffic to, otherwise it return an “Unknown network” error.
177+
proxy the traffic to, otherwise it returns an “Unknown network” error.
178178

179179
The KAS starts with a proxy configuration like the below example.
180180
The example specifies 4 networks. "direct" specifies the KAS talking directly
181-
on the local network (no proxy). "master" specifies the KAS talks to a proxy
182-
listening at 1.2.3.4:5678. "cluster" specifies the KAS talk to a proxy
181+
on the local network (no proxy). "controlplane" specifies the KAS talks to a proxy
182+
listening at 1.2.3.4:5678. "cluster" specifies the KAS talks to a proxy
183183
listening at 1.2.3.5:5679. While these are represented as resources
184184
they are not intended to be loaded dynamically. The names are not case
185185
sensitive. The KAS loads this resource list as a configuration at start time.
@@ -191,7 +191,7 @@ egressSelections:
191191
- name: direct
192192
connection:
193193
type: direct
194-
- name: master
194+
- name: controlplane
195195
connection:
196196
type: grpc
197197
url: grpc://1.2.3.4:5678
@@ -246,10 +246,11 @@ It should run on the same machine and must run in the same flat network as the K
246246
It listens on a port for gRPC connections from the KAS.
247247
This port would be for forwarding traffic to the appropriate cluster.
248248
It should have an administrative port speaking https.
249-
The administrative port serves the liveness probe and metrics.
249+
The administrative port serves metrics and (optional) debug/pprof handlers.
250+
It should have a health check port, serving liveness and readiness probes.
250251
The liveness probe prevents a partially broken cluster
251-
where the KAS cannot connect to the cluster. This port also serves
252-
pprof debug commands and monitoring data for the proxy.
252+
where the KAS cannot connect to the cluster.
253+
The readiness probe indicates that at least one Konnectivity Agent is connected.
253254

254255
### Direct Connection
255256

@@ -264,17 +265,17 @@ Simple clusters (not needing network segregation) run this way to avoid the over
264265
The majority of the KAS communication originates from incoming requests.
265266
Here we cover the outgoing requests. This is our understanding of those requests
266267
and some details as to how they fit in this model. For the alpha release we
267-
support 'master', 'etcd' and 'cluster' connectivity service names.
268+
support 'controlplane', 'etcd' and 'cluster' connectivity service names.
268269

269270
- **ETCD** It is possible to make etcd talk via the proxy.
270271
The etcd client takes a transport.
271-
(https://github.com/etcd-io/etcd/blob/master/client/client.go#L101)
272+
(https://github.com/etcd-io/etcd/blob/main/client/internal/v2/client.go#L101)
272273
We will add configuration as to which proxy an etcd client should use.
273274
(https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/storage/storagebackend/config.go)
274275
This will add an extra process hop to our main scaling axis.
275276
We will scale test the impact and publish the results. As a precaution
276-
we will add an extra network configuration 'etcd' separate from ‘master’.
277-
Etcd requests can be configured separately from the rest of 'master'.
277+
we will add an extra network configuration 'etcd' separate from ‘controlplane’.
278+
Etcd requests can be configured separately from the rest of 'controlplane'.
278279
- **Pods/Exec**, **Pods/Proxy**, **Pods/Portforward**, **Pods/Attach**, **Pods/Log**
279280
Pod requests (and pod sub-resource requests) are meant for the cluster
280281
and will be routed based on the ‘cluster’ NetworkContext.
@@ -287,14 +288,13 @@ and will be routed based on the ‘cluster’ NetworkContext.
287288
- **Admission Webhooks**
288289
Admission webhooks can be destined for a service or a URL.
289290
If destined for a service then the service rules apply (send to 'cluster').
290-
If destined for a URL then we will use the ‘master’ NetworkContext.
291+
If destined for a URL then we will use the ‘controlplane’ NetworkContext.
291292
- **Aggregated API Server (and OpenAPI requests for aggregated resources)**
292-
Aggregated API Servers can be destined for a service or a URL.
293+
Aggregated API Servers can be destined for a service.
293294
If destined for a service then the service rules apply.
294-
If destined for a URL then we will use the ‘master’ NetworkContext.
295295
- **Authentication, Authorization and Audit Webhooks**
296296
These Webhooks use a kube config file to determine destination.
297-
Given that we use a ‘master’ NetworkContext.
297+
Given that we use a ‘controlplane’ NetworkContext.
298298

299299
**Note**: KMS is also an egress endpoint but will not be covered as egress since it only supports a [Dialer](https://github.com/kubernetes/kubernetes/blob/e8bc121341807f9e33a076f6725b1b1a18d75ba0/staging/src/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/grpc_service.go#L74) using unix domain sockets (UDS). This is used for communicating between processes running on the same host. In the future, we may consider adding egressSelector support if KMS accepts other protocols.
300300

@@ -321,28 +321,28 @@ implementation of the API Server Network Proxy.
321321

322322
## User Stories
323323

324-
#### Combined Master and Node Network
324+
#### Combined Control Plane and Node Network
325325

326-
Customers can run a cluster which combines the master and cluster networks.
326+
Customers can run a cluster which combines the control plane and cluster networks.
327327
They configure all their connectivity configuration to direct.
328328
This bypasses the proxy and optimizes the performance. For a customer with no
329329
security concerns with combined network, this is a fairly simple straight forward configuration.
330330

331-
#### Master and Untrusted Node Network
331+
#### Control Plane and Untrusted Node Network
332332

333-
A customer may want to isolate their master from their cluster network. This may be a
333+
A customer may want to isolate their control plane from their cluster network. This may be a
334334
simple separation of concerns or due to something like running untrusted workloads on
335-
the cluster network. Placing a firewall between the master and
335+
the cluster network. Placing a firewall between the control plane and
336336
cluster networks accomplishes this. A few ports for the KAS public port and Proxy public port
337337
are opened between these networks. Separation of concerns minimizes the
338-
accidental interactions between the master and cluster networks. It minimizes bandwidth
338+
accidental interactions between the control plane and cluster networks. It minimizes bandwidth
339339
consumption on the cluster network negatively impacting the control plane. The
340340
combination of firewall and proxy minimizes the interaction between the networks to
341341
a set which can be more easily reasoned about, checked and monitored.
342342

343-
#### Master and Node Networks which are not IP Routable
343+
#### Control Plane and Node Networks which are not IP Routable
344344

345-
If master and cluster network CIDRs are not controlled by the same entity, then they
345+
If control plane and cluster network CIDRs are not controlled by the same entity, then they
346346
can end up having conflicting IP CIDRs. Traffic cannot be routed between
347347
them based strictly on IP address. The connection proxy solves this issue.
348348
It also solves connectivity using a VPN tunnel. The proxy offloads the work off sending traffic
@@ -352,7 +352,7 @@ to the cluster network from the KAS. The proxy gives us extensibility.
352352

353353
Instrumenting the network proxy requests with out of band data
354354
(Eg. requester identity/tradition context) enables a Proxy to
355-
provide increased monitoring of Master originated requests.
355+
provide increased monitoring of Control Plane originated requests.
356356

357357

358358
## Design Details
@@ -367,7 +367,7 @@ both for several releases.
367367

368368
### Test Plan
369369

370-
The primary test plan is to set up a network namespace with a firewall dividing the master and cluster
370+
The primary test plan is to set up a network namespace with a firewall dividing the control plane and cluster
371371
networks. Then running the existing tests for logs, proxy and portforward to ensure the
372372
routing works correctly. It should work with the correct configuration and fail correctly
373373
with a direct configuration. Normal tests would be run with the direct
@@ -408,6 +408,8 @@ Beta:
408408
- Feature went Alpha in 1.16 with limited functionality. It will cover the log
409409
sub resource and communication to the etcd server.
410410

411+
- Feature went Beta in 1.18.
412+
411413
## Alternatives [optional]
412414

413415
- Leave SSH Tunnels (deprecated) in the KAS. Prevents us from making the KAS cloud provider agnostic. Blocks out of tree effort.
@@ -416,5 +418,5 @@ Beta:
416418

417419
## Infrastructure Needed [optional]
418420

419-
Any one wishing to use this feature will need to create network proxy images/pods on the master and set up the ConnectivityServiceConfiguration.
421+
Any one wishing to use this feature will need to create network proxy images/pods on the control plane and set up the EgressSelectorConfiguration.
420422
The network proxy provided is meant as a reference implementation. Users as expected to extend it for their needs.

0 commit comments

Comments
 (0)