Debian Codegraph @

README.md

raw
1 # apiserver-network-proxy
2
3 Created due to https://github.com/kubernetes/org/issues/715.
4
5 See [the KEP proposal for architecture and details](https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/1281-network-proxy#proposal).
6
7 ## Community, discussion, contribution, and support
8
9 Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).
10
11 You can reach the maintainers of this project at:
12
13 - [Slack channel](https://kubernetes.slack.com/messages/apiserver-network-proxy)
14 - [Mailing list](https://groups.google.com/forum/#!forum/kubernetes-sig-cloud-provider)
15
16 ### Code of conduct
17
18 Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).
19
20 ## Versioning and releases
21
22 As of the `0.28.0` release, the apiserver-network-proxy project is changing its versioning and release
23 process. Going forward the project will adhere to these rules:
24
25 * This project follows semantic versioning (eg `x.y.z`) for releases and tags.
26 * Tags indicate readiness for a release, and project maintainers will create corresponding releases.
27 * Releases and tags align with the Kubernetes minor release versions (the `y` in `x.y.z`). For instance,
28 if Kubernetes releases version `1.99.0`, the corresponding release and tag for apiserver-network-proxy will be
29 `0.99.0`.
30 * Branches will be created when the minor release version (the `y` in `x.y.z`) is increased, and follow the
31 pattern of `release-x.y`. For instance, if version `0.99.0` has been released, the corresponding branch
32 will be named `release-0.99`.
33 * Patch level versions for releases and tags will be updated when patches are applied to the specific release
34 branch. For example, if patches must be applied to the `release-0.99` branch and a new release is created,
35 the version will be `0.99.1`. In this manner the patch level version number (the `z` in `x.y.z`) may not
36 match the Kubernetes patch level.
37
38 For Kubernetes version `1.28.0+`, we recommend using the tag that corresponds to the same minor version
39 number. For example, if you are working with Kubernetes version `1.99`, please utilize the latest `0.99`
40 tag and refer to the `release-0.99` branch. It is important to note that there may be disparities in the
41 patch level between apiserver-network-proxy and Kubernetes.
42
43 For Kubernetes version `<=1.27`, it is recommended to match apiserver-network-proxy server & client
44 minor release versions. With Kubernetes, this means:
45
46 * Kubernetes versions v1.26 through v1.27: `0.1.X` tags, `release-0.1` branch.
47 * Kubernetes versions v1.23 through v1.25: `0.0.X` tags, `release-0.0` branch.
48 * Kubernetes versions up to v1.23: apiserver-network-proxy versions up to `v0.0.30`.
49 Refer to the kubernetes go.mod file for the specific release version.
50
51 ## Build
52
53 Please make sure you have the REGISTRY and PROJECT_ID environment variables set.
54 For local builds these can be set to anything.
55 For image builds these determine the location of your image.
56 For GCE the registry should be gcr.io and PROJECT_ID should be the project you
57 want to use the images in.
58 Please ensure the go bin directory (usually `~/go/bin`) is in your `PATH`.
59
60 ### Mockgen
61
62 The [```mockgen```](https://github.com/uber-go/mock) tool must be installed on your system.
63
64 Currently, we are using go.uber.org/mock/[email protected]
65
66 `go install go.uber.org/mock/[email protected]`
67
68 ### Protoc
69
70 Proto definitions are compiled with `protoc`. Please ensure you have protoc installed ([Instructions](https://grpc.io/docs/languages/go/quickstart/)) and the `protoc-gen-go` and `protoc-gen-go-grpc` libraries at the appropriate version.
71
72 Currently, we are using [email protected]
73
74 `go install google.golang.org/protobuf/cmd/[email protected]`
75
76 Currently, we are using [email protected]
77
78 `go install google.golang.org/grpc/cmd/[email protected]`
79
80 ### Local builds
81
82 ```console
83 make clean
84 make certs
85 make gen
86 make build
87 ```
88
89 ### Build images
90
91 ```console
92 make docker-build
93 ```
94
95 ## Examples
96
97 The current examples run two actual services as well as a sample client on one end and a sample destination for
98 requests on the other.
99 - *Proxy service:* The proxy service takes the API server requests and forwards them appropriately.
100 - *Agent service:* The agent service connects to the proxy and then allows traffic to be forwarded to it.
101
102 ### GRPC Client using mTLS Proxy with dial back Agent
103
104 ```
105 Frontend client =HTTP over GRPC=> (:8090) proxy (:8091) <=GRPC= agent =HTTP=> http-test-server(:8000)
106 | ^
107 | Tunnel |
108 +---------------------------------------------------------------+
109 ```
110
111 - Start Simple test HTTP Server (Sample destination)
112 ```console
113 ./bin/http-test-server
114 ```
115
116 - Start proxy service
117 ```console
118 ./bin/proxy-server --server-ca-cert=certs/frontend/issued/ca.crt --server-cert=certs/frontend/issued/proxy-frontend.crt --server-key=certs/frontend/private/proxy-frontend.key --cluster-ca-cert=certs/agent/issued/ca.crt --cluster-cert=certs/agent/issued/proxy-frontend.crt --cluster-key=certs/agent/private/proxy-frontend.key
119 ```
120
121 - Start agent service
122 ```console
123 ./bin/proxy-agent --ca-cert=certs/agent/issued/ca.crt --agent-cert=certs/agent/issued/proxy-agent.crt --agent-key=certs/agent/private/proxy-agent.key
124 ```
125
126 - Run client (mTLS enabled sample client)
127 ```console
128 ./bin/proxy-test-client --ca-cert=certs/frontend/issued/ca.crt --client-cert=certs/frontend/issued/proxy-client.crt --client-key=certs/frontend/private/proxy-client.key
129 ```
130
131 ### GRPC+UDS Client using Proxy with dial back Agent
132
133 ```
134 Frontend client =HTTP over GRPC+UDS=> (/tmp/uds-proxy) proxy (:8091) <=GRPC= agent =HTTP=> SimpleHTTPServer(:8000)
135 | ^
136 | Tunnel |
137 +----------------------------------------------------------------------------+
138 ```
139
140 - Start Simple test HTTP Server (Sample destination)
141 ```console
142 ./bin/http-test-server
143 ```
144
145 - Start proxy service
146 ```console
147 ./bin/proxy-server --server-port=0 --uds-name=/tmp/uds-proxy --cluster-ca-cert=certs/agent/issued/ca.crt --cluster-cert=certs/agent/issued/proxy-frontend.crt --cluster-key=certs/agent/private/proxy-frontend.key
148 ```
149
150 - Start agent service
151 ```console
152 ./bin/proxy-agent --ca-cert=certs/agent/issued/ca.crt --agent-cert=certs/agent/issued/proxy-agent.crt --agent-key=certs/agent/private/proxy-agent.key
153 ```
154
155 - Run client (mTLS enabled sample client)
156 ```console
157 ./bin/proxy-test-client --proxy-port=0 --proxy-uds=/tmp/uds-proxy --proxy-host=""
158 ```
159
160
161 ### HTTP-Connect Client using mTLS Proxy with dial back Agent (Either curl OR test client)
162
163 ```
164 Frontend client =HTTP-CONNECT=> (:8090) proxy (:8091) <=GRPC= agent =HTTP=> SimpleHTTPServer(:8000)
165 | ^
166 | Tunnel |
167 +-------------------------------------------------------------+
168 ```
169
170 - Start SimpleHTTPServer (Sample destination)
171 ```console
172 ./bin/http-test-server
173 ```
174
175 - Start proxy service
176 ```console
177 ./bin/proxy-server --mode=http-connect --server-ca-cert=certs/frontend/issued/ca.crt --server-cert=certs/frontend/issued/proxy-frontend.crt --server-key=certs/frontend/private/proxy-frontend.key --cluster-ca-cert=certs/agent/issued/ca.crt --cluster-cert=certs/agent/issued/proxy-frontend.crt --cluster-key=certs/agent/private/proxy-frontend.key
178 ```
179
180 - Start agent service
181 ```console
182 ./bin/proxy-agent --ca-cert=certs/agent/issued/ca.crt --agent-cert=certs/agent/issued/proxy-agent.crt --agent-key=certs/agent/private/proxy-agent.key
183 ```
184
185 - Run client (mTLS & http-connect enabled sample client)
186 ```console
187 ./bin/proxy-test-client --mode=http-connect --proxy-host=127.0.0.1 --ca-cert=certs/frontend/issued/ca.crt --client-cert=certs/frontend/issued/proxy-client.crt --client-key=certs/frontend/private/proxy-client.key
188 ```
189
190 - Run curl client (curl using a mTLS http-connect proxy)
191 ```console
192 curl -v -p --proxy-key certs/frontend/private/proxy-client.key --proxy-cert certs/frontend/issued/proxy-client.crt --proxy-cacert certs/frontend/issued/ca.crt --proxy-cert-type PEM -x https://127.0.0.1:8090 http://localhost:8000/success
193 ```
194
195 ### Running on kubernetes
196 See following [README.md](examples/kubernetes/README.md)
197
198 ### Running on a local kubernetes cluster with `kind`
199 See this [README.md](examples/kind/README.md) for an example that creates a local kubernetes cluster using` kind` and
200 deploys the proxy agent on a worker node and the proxy server on a control plane node.
201
202 See this [README.md](examples/kind-multinode/README.md) for a similar example that creates a `kind` cluster with a
203 user-configurable number of control plane and worker nodes and optionally sideloads custom proxy agent and server images.
204
205 ### Tutorials
206
207 See this [Set up Konnectivity service](https://kubernetes.io/docs/tasks/extend-kubernetes/setup-konnectivity/) tutorial for
208 an example of the Konnectivity service providing a TCP level proxy for the control plane to cluster communication.
209
210 ### Clients
211
212 `apiserver-network-proxy` components are intended to run as standalone binaries and should not be imported as a library. Clients communicating with the network proxy can import the `konnectivity-client` module.