Skip to content

Commit fb8f9b8

Browse files
authored
Merge pull request #43841 from windsonsea/clusty
Clean up access-application-cluster/access-cluster
2 parents 957b08b + 7e323ad commit fb8f9b8

File tree

1 file changed

+66
-58
lines changed

1 file changed

+66
-58
lines changed

content/en/docs/tasks/access-application-cluster/access-cluster.md

Lines changed: 66 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ When accessing the Kubernetes API for the first time, we suggest using the
1616
Kubernetes CLI, `kubectl`.
1717

1818
To access a cluster, you need to know the location of the cluster and have credentials
19-
to access it. Typically, this is automatically set-up when you work through
19+
to access it. Typically, this is automatically set-up when you work through
2020
a [Getting started guide](/docs/setup/),
2121
or someone else set up the cluster and provided you with credentials and a location.
2222

@@ -36,20 +36,20 @@ Kubectl handles locating and authenticating to the apiserver.
3636
If you want to directly access the REST API with an http client like
3737
curl or wget, or a browser, there are several ways to locate and authenticate:
3838

39-
- Run kubectl in proxy mode.
40-
- Recommended approach.
41-
- Uses stored apiserver location.
42-
- Verifies identity of apiserver using self-signed cert. No MITM possible.
43-
- Authenticates to apiserver.
44-
- In future, may do intelligent client-side load-balancing and failover.
45-
- Provide the location and credentials directly to the http client.
46-
- Alternate approach.
47-
- Works with some types of client code that are confused by using a proxy.
48-
- Need to import a root cert into your browser to protect against MITM.
39+
- Run kubectl in proxy mode.
40+
- Recommended approach.
41+
- Uses stored apiserver location.
42+
- Verifies identity of apiserver using self-signed cert. No MITM possible.
43+
- Authenticates to apiserver.
44+
- In future, may do intelligent client-side load-balancing and failover.
45+
- Provide the location and credentials directly to the http client.
46+
- Alternate approach.
47+
- Works with some types of client code that are confused by using a proxy.
48+
- Need to import a root cert into your browser to protect against MITM.
4949

5050
### Using kubectl proxy
5151

52-
The following command runs kubectl in a mode where it acts as a reverse proxy. It handles
52+
The following command runs kubectl in a mode where it acts as a reverse proxy. It handles
5353
locating the apiserver and authenticating.
5454
Run it like this:
5555

@@ -83,7 +83,6 @@ The output is similar to this:
8383
}
8484
```
8585

86-
8786
### Without kubectl proxy
8887

8988
Use `kubectl apply` and `kubectl describe secret...` to create a token for the default service account with grep/cut:
@@ -163,16 +162,16 @@ The output is similar to this:
163162
}
164163
```
165164

166-
The above examples use the `--insecure` flag. This leaves it subject to MITM
167-
attacks. When kubectl accesses the cluster it uses a stored root certificate
168-
and client certificates to access the server. (These are installed in the
169-
`~/.kube` directory). Since cluster certificates are typically self-signed, it
165+
The above examples use the `--insecure` flag. This leaves it subject to MITM
166+
attacks. When kubectl accesses the cluster it uses a stored root certificate
167+
and client certificates to access the server. (These are installed in the
168+
`~/.kube` directory). Since cluster certificates are typically self-signed, it
170169
may take special configuration to get your http client to use root
171170
certificate.
172171

173172
On some clusters, the apiserver does not require authentication; it may serve
174-
on localhost, or be protected by a firewall. There is not a standard
175-
for this. [Controlling Access to the API](/docs/concepts/security/controlling-access)
173+
on localhost, or be protected by a firewall. There is not a standard
174+
for this. [Controlling Access to the API](/docs/concepts/security/controlling-access)
176175
describes how a cluster admin can configure this.
177176

178177
## Programmatic access to the API
@@ -182,20 +181,30 @@ client libraries.
182181

183182
### Go client
184183

185-
* To get the library, run the following command: `go get k8s.io/client-go@kubernetes-<kubernetes-version-number>`, see [INSTALL.md](https://github.com/kubernetes/client-go/blob/master/INSTALL.md#for-the-casual-user) for detailed installation instructions. See [https://github.com/kubernetes/client-go](https://github.com/kubernetes/client-go#compatibility-matrix) to see which versions are supported.
186-
* Write an application atop of the client-go clients. Note that client-go defines its own API objects, so if needed, please import API definitions from client-go rather than from the main repository, e.g., `import "k8s.io/client-go/kubernetes"` is correct.
184+
* To get the library, run the following command: `go get k8s.io/client-go@kubernetes-<kubernetes-version-number>`,
185+
see [INSTALL.md](https://github.com/kubernetes/client-go/blob/master/INSTALL.md#for-the-casual-user)
186+
for detailed installation instructions. See
187+
[https://github.com/kubernetes/client-go](https://github.com/kubernetes/client-go#compatibility-matrix)
188+
to see which versions are supported.
189+
* Write an application atop of the client-go clients. Note that client-go defines its own API objects,
190+
so if needed, please import API definitions from client-go rather than from the main repository,
191+
e.g., `import "k8s.io/client-go/kubernetes"` is correct.
187192

188193
The Go client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
189-
as the kubectl CLI does to locate and authenticate to the apiserver. See this [example](https://git.k8s.io/client-go/examples/out-of-cluster-client-configuration/main.go).
194+
as the kubectl CLI does to locate and authenticate to the apiserver. See this
195+
[example](https://git.k8s.io/client-go/examples/out-of-cluster-client-configuration/main.go).
190196

191197
If the application is deployed as a Pod in the cluster, please refer to the [next section](#accessing-the-api-from-a-pod).
192198

193199
### Python client
194200

195-
To use [Python client](https://github.com/kubernetes-client/python), run the following command: `pip install kubernetes`. See [Python Client Library page](https://github.com/kubernetes-client/python) for more installation options.
201+
To use [Python client](https://github.com/kubernetes-client/python), run the following command:
202+
`pip install kubernetes`. See [Python Client Library page](https://github.com/kubernetes-client/python)
203+
for more installation options.
196204

197205
The Python client can use the same [kubeconfig file](/docs/concepts/configuration/organize-cluster-access-kubeconfig/)
198-
as the kubectl CLI does to locate and authenticate to the apiserver. See this [example](https://github.com/kubernetes-client/python/tree/master/examples).
206+
as the kubectl CLI does to locate and authenticate to the apiserver. See this
207+
[example](https://github.com/kubernetes-client/python/tree/master/examples).
199208

200209
### Other languages
201210

@@ -218,52 +227,51 @@ For information about connecting to other services running on a Kubernetes clust
218227

219228
## Requesting redirects
220229

221-
The redirect capabilities have been deprecated and removed. Please use a proxy (see below) instead.
230+
The redirect capabilities have been deprecated and removed. Please use a proxy (see below) instead.
222231

223-
## So Many Proxies
232+
## So many proxies
224233

225234
There are several different proxies you may encounter when using Kubernetes:
226235

227-
1. The [kubectl proxy](#directly-accessing-the-rest-api):
236+
1. The [kubectl proxy](#directly-accessing-the-rest-api):
228237

229-
- runs on a user's desktop or in a pod
230-
- proxies from a localhost address to the Kubernetes apiserver
231-
- client to proxy uses HTTP
232-
- proxy to apiserver uses HTTPS
233-
- locates apiserver
234-
- adds authentication headers
238+
- runs on a user's desktop or in a pod
239+
- proxies from a localhost address to the Kubernetes apiserver
240+
- client to proxy uses HTTP
241+
- proxy to apiserver uses HTTPS
242+
- locates apiserver
243+
- adds authentication headers
235244

236-
1. The [apiserver proxy](/docs/tasks/access-application-cluster/access-cluster-services/#discovering-builtin-services):
245+
1. The [apiserver proxy](/docs/tasks/access-application-cluster/access-cluster-services/#discovering-builtin-services):
237246

238-
- is a bastion built into the apiserver
239-
- connects a user outside of the cluster to cluster IPs which otherwise might not be reachable
240-
- runs in the apiserver processes
241-
- client to proxy uses HTTPS (or http if apiserver so configured)
242-
- proxy to target may use HTTP or HTTPS as chosen by proxy using available information
243-
- can be used to reach a Node, Pod, or Service
244-
- does load balancing when used to reach a Service
247+
- is a bastion built into the apiserver
248+
- connects a user outside of the cluster to cluster IPs which otherwise might not be reachable
249+
- runs in the apiserver processes
250+
- client to proxy uses HTTPS (or http if apiserver so configured)
251+
- proxy to target may use HTTP or HTTPS as chosen by proxy using available information
252+
- can be used to reach a Node, Pod, or Service
253+
- does load balancing when used to reach a Service
245254

246-
1. The [kube proxy](/docs/concepts/services-networking/service/#ips-and-vips):
255+
1. The [kube proxy](/docs/concepts/services-networking/service/#ips-and-vips):
247256

248-
- runs on each node
249-
- proxies UDP and TCP
250-
- does not understand HTTP
251-
- provides load balancing
252-
- is only used to reach services
257+
- runs on each node
258+
- proxies UDP and TCP
259+
- does not understand HTTP
260+
- provides load balancing
261+
- is only used to reach services
253262

254-
1. A Proxy/Load-balancer in front of apiserver(s):
263+
1. A Proxy/Load-balancer in front of apiserver(s):
255264

256-
- existence and implementation varies from cluster to cluster (e.g. nginx)
257-
- sits between all clients and one or more apiservers
258-
- acts as load balancer if there are several apiservers.
265+
- existence and implementation varies from cluster to cluster (e.g. nginx)
266+
- sits between all clients and one or more apiservers
267+
- acts as load balancer if there are several apiservers.
259268

260-
1. Cloud Load Balancers on external services:
269+
1. Cloud Load Balancers on external services:
261270

262-
- are provided by some cloud providers (e.g. AWS ELB, Google Cloud Load Balancer)
263-
- are created automatically when the Kubernetes service has type `LoadBalancer`
264-
- use UDP/TCP only
265-
- implementation varies by cloud provider.
271+
- are provided by some cloud providers (e.g. AWS ELB, Google Cloud Load Balancer)
272+
- are created automatically when the Kubernetes service has type `LoadBalancer`
273+
- use UDP/TCP only
274+
- implementation varies by cloud provider.
266275

267-
Kubernetes users will typically not need to worry about anything other than the first two types. The cluster admin
276+
Kubernetes users will typically not need to worry about anything other than the first two types. The cluster admin
268277
will typically ensure that the latter types are set up correctly.
269-

0 commit comments

Comments
 (0)