Skip to content

Commit 7174156

Browse files
authored
Merge pull request #39420 from mengjiao-liu/resync-blog-grpc-probes-in-beta
[zh-cn] Resync 2022-05-13-grpc-probes-in-beta.md
2 parents 9077630 + 906f70b commit 7174156

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

content/zh-cn/blog/_posts/2022-05-13-grpc-probes-in-beta.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ slug: grpc-probes-now-in-beta
1616
-->
1717
**作者**:Sergey Kanzhelev (Google)
1818

19+
**译者**:Xiaoyang Zhang(Huawei)
20+
1921
<!--
2022
With Kubernetes 1.24 the gRPC probes functionality entered beta and is available by default.
2123
Now you can configure startup, liveness, and readiness probes for your gRPC app
22-
without exposing any HTTP endpoint, nor do you need an executable. Kubernetes can natively connect to your your workload via gRPC and query its status.
24+
without exposing any HTTP endpoint, nor do you need an executable. Kubernetes can natively connect to your workload via gRPC and query its status.
2325
-->
2426
在 Kubernetes 1.24 中,gRPC 探针(probe)功能进入了 beta 阶段,默认情况下可用。
2527
现在,你可以为 gRPC 应用程序配置启动、活跃和就绪探测,而无需公开任何 HTTP 端点,
@@ -63,7 +65,7 @@ the first release at [Sep 19, 2018](https://github.com/grpc-ecosystem/grpc-healt
6365
<!--
6466
This approach for gRPC apps health checking is very popular. There are [3,626 Dockerfiles](https://github.com/search?l=Dockerfile&q=grpc_health_probe&type=code)
6567
with the `grpc_health_probe` and [6,621 yaml](https://github.com/search?l=YAML&q=grpc_health_probe&type=Code) files that are discovered with the
66-
basic search on GitHub (at the moment of writing). This is good indication of the tool popularity
68+
basic search on GitHub (at the moment of writing). This is a good indication of the tool popularity
6769
and the need to support this natively.
6870
-->
6971
这种 gRPC 应用健康检查的方法非常受欢迎。使用 GitHub 上的基本搜索,发现了带有 `grpc_health_probe`
@@ -203,30 +205,31 @@ exposes ports `5000` and `8080`, and configures gRPC readiness probe:
203205
-->
204206
下面是一个 Pod 定义示例。它启用 `grpc-health-checking` 模块,暴露 5000 和 8080 端口,并配置 gRPC 就绪探针:
205207

206-
``` yaml
208+
```yaml
207209
---
208210
apiVersion: v1
209211
kind: Pod
210212
metadata:
211213
name: test-grpc
212214
spec:
213215
containers:
214-
- name: agnhost
215-
image: k8s.gcr.io/e2e-test-images/agnhost:2.35
216-
command: ["/agnhost", "grpc-health-checking"]
217-
ports:
218-
- containerPort: 5000
219-
- containerPort: 8080
220-
readinessProbe:
221-
grpc:
222-
port: 5000
216+
- name: agnhost
217+
# 镜像自发布以来已更改(以前使用的仓库为 "k8s.gcr.io")
218+
image: registry.k8s.io/e2e-test-images/agnhost:2.35
219+
command: ["/agnhost", "grpc-health-checking"]
220+
ports:
221+
- containerPort: 5000
222+
- containerPort: 8080
223+
readinessProbe:
224+
grpc:
225+
port: 5000
223226
```
224227
225228
<!--
226-
If the file called `test.yaml`, you can create the pod and check it's status.
229+
In the manifest file called `test.yaml`, you can create the pod and check its status.
227230
The pod will be in ready state as indicated by the snippet of the output.
228231
-->
229-
如果文件名为 `test.yaml`,你可以用以下命令创建 Pod,并检查它的状态。如输出片段所示,Pod 将处于就绪状态。
232+
如果清单文件名为 `test.yaml`,你可以用以下命令创建 Pod,并检查它的状态。如输出片段所示,Pod 将处于就绪状态。
230233

231234
```shell
232235
kubectl apply -f test.yaml
@@ -298,7 +301,7 @@ Once it is switched back, in about one second the Pod will get back to ready sta
298301
-->
299302
一旦切换回来,Pod 将在大约一秒钟后恢复到就绪状态:
300303

301-
``` bsh
304+
```bash
302305
curl http://localhost:8080/make-serving
303306
kubectl describe test-grpc
304307
```

0 commit comments

Comments
 (0)