Skip to content

Commit 61dd188

Browse files
authored
Merge pull request #34606 from tengqm/zh-resync-socks5
[zh-cn] Resync sockets5 proxy page
2 parents 7fb6201 + 297ceb5 commit 61dd188

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

content/zh-cn/docs/tasks/extend-kubernetes/socks5-proxy-access-api.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ You must be able to log in to the SSH service on the remote server.
3131
<!--
3232
## Task context
3333
-->
34-
## 任务上下文
34+
## 任务上下文 {#task-context}
3535

36+
{{< note >}}
3637
<!--
3738
This example tunnels traffic using SSH, with the SSH client and server acting as a SOCKS proxy.
3839
You can instead use any other kind of [SOCKS5](https://en.wikipedia.org/wiki/SOCKS#SOCKS5) proxies.
3940
-->
40-
{{< note >}}
4141
此示例使用 SSH 隧道传输流量,SSH 客户端和服务器充当 SOCKS 代理。
4242
你可以使用其他任意类型的 [SOCKS5](https://zh.wikipedia.org/wiki/SOCKS#SOCKS5) 代理代替。
4343
{{</ note >}}
@@ -53,11 +53,12 @@ Figure 1 represents what you're going to achieve in this task.
5353
-->
5454
图 1 表示你将在此任务中实现的目标。
5555

56-
* 你有一台在后面的步骤中被称为本地计算机的客户端计算机,你将在这台计算机上创建与 Kubernetes API 对话的请求。
56+
* 你有一台在后面的步骤中被称为本地计算机的客户端计算机,你将在这台计算机上创建与
57+
Kubernetes API 对话的请求。
5758
* Kubernetes 服务器/API 托管在远程服务器上。
5859
* 你将使用 SSH 客户端和服务器软件在本地和远程服务器之间创建安全的 SOCKS5 隧道。
59-
客户端和 Kubernetes API 之间的 HTTPS 流量将流经 SOCKS5 隧道,该隧道本身通过 SSH 进行隧道传输。
60-
60+
客户端和 Kubernetes API 之间的 HTTPS 流量将流经 SOCKS5 隧道,该隧道本身通过
61+
SSH 进行隧道传输。
6162

6263
<!--
6364
graph LR;
@@ -108,13 +109,12 @@ Figure 1. SOCKS5 tutorial components
108109

109110
<!--
110111
## Using ssh to create a SOCKS5 proxy
111-
-->
112-
## 使用 ssh 创建 SOCKS5 代理
113112
114-
<!--
115113
This command starts a SOCKS5 proxy between your client machine and the remote server.
116114
The SOCKS5 proxy lets you connect to your cluster's API server.
117115
-->
116+
## 使用 SSH 创建 SOCKS5 代理
117+
118118
此命令在你的客户端计算机和远程服务器之间启动一个 SOCKS5 代理。
119119
SOCKS5 代理允许你连接到集群的 API 服务器。
120120

@@ -136,16 +136,16 @@ ssh -D 1080 -q -N [email protected]
136136

137137
<!--
138138
## Client configuration
139-
-->
140-
## 客户端配置
141139
142-
<!--
143140
To explore the Kubernetes API you'll first need to instruct your clients to send their queries through
144141
the SOCKS5 proxy we created earlier.
145142
146143
For command-line tools, set the `https_proxy` environment variable and pass it to commands that you run.
147144
-->
148-
要探索 Kubernetes API,你首先需要指示你的客户端通过我们之前创建的 SOCKS5 代理发送他们的查询。
145+
## 客户端配置
146+
147+
要探索 Kubernetes API,你首先需要指示你的客户端通过我们之前创建的 SOCKS5
148+
代理发送他们的查询。
149149
对于命令行工具,设置 `https_proxy` 环境变量并将其传递给你运行的命令。
150150

151151
```shell
@@ -155,22 +155,21 @@ export https_proxy=socks5h://localhost:1080
155155
<!--
156156
When you set the `https_proxy` variable, tools such as `curl` route HTTPS traffic through the proxy
157157
you configured. For this to work, the tool must support SOCKS5 proxying.
158+
-->
159+
当你设置 `https_proxy` 变量时,`curl` 等工具会通过你配置的代理路由 HTTPS 流量。
160+
为此,该工具必须支持 SOCKS5 代理。
158161

159162
{{< note >}}
163+
<!--
160164
In the URL https://localhost/api, `localhost` does not refer to your local client computer.
161-
Instead, it refers to the endpoint on the remote server knows as `localhost`.
165+
Instead, it refers to the endpoint on the remote server known as `localhost`.
162166
The `curl` tool sends the hostname from the HTTPS URL over SOCKS, and the remote server
163167
resolves that locally (to an address that belongs to its loopback interface).
164-
{{</ note >}}
165168
-->
166-
当你设置 `https_proxy` 变量时,`curl` 等工具会通过你配置的代理路由 HTTPS 流量。
167-
为此,该工具必须支持 SOCKS5 代理。
168-
169-
{{< note >}}
170169
在 URL https://localhost/api 中,`localhost` 不是指你的本地客户端计算机。
171170
它指的是远程服务器上称为 “localhost” 的端点。
172171
`curl` 工具通过 SOCKS 从 HTTPS URL 发送主机名,远程服务器在本地解析(到属于其环回接口的地址)。
173-
{{</ note >}}
172+
{{< /note >}}
174173

175174
```shell
176175
curl -k -v https://localhost/api
@@ -187,9 +186,11 @@ for the relevant `cluster` entry within your `~/.kube/config` file. For example
187186
apiVersion: v1
188187
clusters:
189188
- cluster:
190-
certificate-authority-data: LRMEMMW2 # 为了便于阅读缩短
191-
server: https://localhost # 上图中的“Kubernetes API”
192-
proxy-url: socks5://localhost:1080 # 上图中的“SSH SOCKS5代理”(内置DNS解析)
189+
certificate-authority-data: LRMEMMW2 # 简化以便阅读
190+
# “Kubernetes API”服务器,换言之,kubernetes-remote-server.example 的 IP 地址
191+
server: https://<API_SERVER_IP_ADRESS>:6443
192+
# 上图中的“SSH SOCKS5代理”(内置 DNS 解析)
193+
proxy-url: socks5://localhost:1080
193194
name: default
194195
contexts:
195196
- context:
@@ -202,8 +203,8 @@ preferences: {}
202203
users:
203204
- name: default
204205
user:
205-
client-certificate-data: LS0tLS1CR== # 为了便于阅读缩短
206-
client-key-data: LS0tLS1CRUdJT= # 为了便于阅读缩短
206+
client-certificate-data: LS0tLS1CR== # 节略,为了便于阅读
207+
client-key-data: LS0tLS1CRUdJT= # 节略,为了便于阅读
207208
```
208209
209210
<!--
@@ -223,24 +224,23 @@ kube-system coredns-85cb69466-klwq8 1/1 Running 0
223224

224225
<!--
225226
## Clean up
226-
-->
227-
## 清理
228227

229-
<!--
230228
Stop the ssh port-forwarding process by pressing `CTRL+C` on the terminal where it is running.
231229

232230
Type `unset https_proxy` in a terminal to stop forwarding http traffic through the proxy.
233231
-->
234-
通过在运行它的终端上按“CTRL+C”来停止 ssh 端口转发进程。
232+
## 清理
233+
234+
通过在运行它的终端上按 “CTRL+C” 来停止 SSH 端口转发进程。
235235

236236
在终端中键入 `unset https_proxy` 以停止通过代理转发 http 流量。
237237

238238
<!--
239239
## Further reading
240-
-->
241-
## 进一步阅读
242240

243-
<!--
244241
* [OpenSSH remote login client](https://man.openbsd.org/ssh)
245242
-->
246-
* [OpenSSH远程登录客户端](https://man.openbsd.org/ssh)
243+
## 进一步阅读
244+
245+
* [OpenSSH远程登录客户端](https://man.openbsd.org/ssh)
246+

0 commit comments

Comments
 (0)