You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/zh-cn/docs/tasks/configure-pod-container/static-pod.md
+41-25Lines changed: 41 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,26 +130,6 @@ For example, this is how to start a simple web server as a static Pod:
130
130
131
131
<!--
132
132
2. Choose a directory, say `/etc/kubernetes/manifests` and place a web server Pod definition there, for example `/etc/kubernetes/manifests/static-web.yaml`:
133
-
134
-
```shell
135
-
# Run this command on the node where kubelet is running
136
-
mkdir /etc/kubelet.d/
137
-
cat <<EOF >/etc/kubelet.d/static-web.yaml
138
-
apiVersion: v1
139
-
kind: Pod
140
-
metadata:
141
-
name: static-web
142
-
labels:
143
-
role: myrole
144
-
spec:
145
-
containers:
146
-
- name: web
147
-
image: nginx
148
-
ports:
149
-
- name: web
150
-
containerPort: 80
151
-
protocol: TCP
152
-
EOF
153
133
-->
154
134
2. 选择一个目录,比如在 `/etc/kubernetes/manifests` 目录来保存 Web 服务 Pod 的定义文件,例如
155
135
`/etc/kubernetes/manifests/static-web.yaml`:
@@ -230,7 +210,7 @@ JSON/YAML 格式的 Pod 定义文件。
230
210
<!--
231
211
1. Create a YAML file and store it on a web server so that you can pass the URL of that file to the kubelet.
232
212
-->
233
-
1. 创建一个 YAML 文件,并保存在 web 服务上,为 kubelet 生成一个 URL。
213
+
1. 创建一个 YAML 文件,并保存在 Web 服务器上,这样你就可以将该文件的 URL 传递给 kubelet。
234
214
235
215
```yaml
236
216
apiVersion: v1
@@ -286,8 +266,6 @@ You can view running containers (including static Pods) by running (on the node)
286
266
# Run this command on the node where the kubelet is running
287
267
crictl ps
288
268
```
289
-
290
-
The output might be something like:
291
269
-->
292
270
## 观察静态 Pod 的行为 {#behavior-of-static-pods}
293
271
@@ -405,6 +383,28 @@ CONTAINER IMAGE CREATED STATE
405
383
89db4553e1eeb docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106
406
384
```
407
385
386
+
<!--
387
+
Once you identify the right container, you can get the logs for that container with `crictl`:
To find more about how to debug using `crictl`, please visit [_Debugging Kubernetes nodes with crictl_](https://kubernetes.io/docs/tasks/debug/debug-cluster/crictl/)
@@ -418,7 +418,7 @@ The running kubelet periodically scans the configured directory (`/etc/kubernete
418
418
<!--
419
419
```shell
420
420
# This assumes you are using filesystem-hosted static Pod configuration
421
-
# Run these commands on the node where the kubelet is running
421
+
# Run these commands on the node where the container is running
422
422
#
423
423
mv /etc/kubernetes/manifests/static-web.yaml /tmp
424
424
sleep 20
@@ -431,7 +431,7 @@ crictl ps
431
431
-->
432
432
```shell
433
433
# 这里假定你在用主机文件系统上的静态 Pod 配置文件
434
-
#在 kubelet 运行的节点上执行以下命令
434
+
#在容器运行所在的节点上执行以下命令
435
435
mv /etc/kubernetes/manifests/static-web.yaml /tmp
436
436
sleep 20
437
437
crictl ps
@@ -446,3 +446,19 @@ CONTAINER IMAGE CREATED STATE
446
446
f427638871c35 docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106
447
447
```
448
448
449
+
## {{% heading "whatsnext" %}}
450
+
451
+
<!--
452
+
* [Generate static Pod manifests for control plane components](/docs/reference/setup-tools/kubeadm/implementation-details/#generate-static-pod-manifests-for-control-plane-components)
453
+
* [Generate static Pod manifest forlocal etcd](/docs/reference/setup-tools/kubeadm/implementation-details/#generate-static-pod-manifest-for-local-etcd)
454
+
* [Debugging Kubernetes nodes with `crictl`](/docs/tasks/debug/debug-cluster/crictl/)
455
+
* [Learn more about `crictl`](https://github.com/kubernetes-sigs/cri-tools).
456
+
* [Map `docker` CLI commands to `crictl`](/docs/reference/tools/map-crictl-dockercli/).
457
+
* [Set up etcd instances as static pods managed by a kubelet](/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/)
458
+
-->
459
+
* [为控制面组件生成静态 Pod 清单](/zh-cn/docs/reference/setup-tools/kubeadm/implementation-details/#generate-static-pod-manifests-for-control-plane-components)
460
+
* [为本地 etcd 生成静态 Pod 清单](/zh-cn/docs/reference/setup-tools/kubeadm/implementation-details/#generate-static-pod-manifest-for-local-etcd)
0 commit comments