Skip to content

Commit 37b7c6f

Browse files
authored
Merge pull request #31410 from chris-short/cbshort-issue-31394
Update static-pod.md
2 parents f7b9625 + 2e870ee commit 37b7c6f

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

content/en/docs/tasks/configure-pod-container/static-pod.md

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The `spec` of a static Pod cannot refer to other API objects
4242

4343
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
4444

45-
This page assumes you're using {{< glossary_tooltip term_id="docker" >}} to run Pods,
45+
This page assumes you're using {{< glossary_tooltip term_id="cri-o" >}} to run Pods,
4646
and that your nodes are running the Fedora operating system.
4747
Instructions for other distributions or Kubernetes installations may vary.
4848

@@ -156,32 +156,36 @@ already be running.
156156
You can view running containers (including static Pods) by running (on the node):
157157
```shell
158158
# Run this command on the node where the kubelet is running
159-
docker ps
159+
crictl ps
160160
```
161161
162162
The output might be something like:
163163
164+
```console
165+
CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID
166+
129fd7d382018 docker.io/library/nginx@sha256:... 11 minutes ago Running web 0 34533c6729106
164167
```
165-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
166-
f6d05272b57e nginx:latest "nginx" 8 minutes ago Up 8 minutes k8s_web.6f802af4_static-web-fk-node1_default_67e24ed9466ba55986d120c867395f3c_378e5f3c
167-
```
168+
169+
{{< note >}}
170+
`crictl` outputs the image URI and SHA-256 checksum. `NAME` will look more like:
171+
`docker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31`.
172+
{{< /note >}}
168173
169174
You can see the mirror Pod on the API server:
170175
171176
```shell
172177
kubectl get pods
173178
```
174179
```
175-
NAME READY STATUS RESTARTS AGE
176-
static-web-my-node1 1/1 Running 0 2m
180+
NAME READY STATUS RESTARTS AGE
181+
static-web 1/1 Running 0 2m
177182
```
178183
179184
{{< note >}}
180185
Make sure the kubelet has permission to create the mirror Pod in the API server. If not, the creation request is rejected by the API server. See
181186
[PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/).
182187
{{< /note >}}
183188
184-
185189
{{< glossary_tooltip term_id="label" text="Labels" >}} from the static Pod are
186190
propagated into the mirror Pod. You can use those labels as normal via
187191
{{< glossary_tooltip term_id="selector" text="selectors" >}}, etc.
@@ -190,34 +194,33 @@ If you try to use `kubectl` to delete the mirror Pod from the API server,
190194
the kubelet _doesn't_ remove the static Pod:
191195
192196
```shell
193-
kubectl delete pod static-web-my-node1
197+
kubectl delete pod static-web
194198
```
195199
```
196-
pod "static-web-my-node1" deleted
200+
pod "static-web" deleted
197201
```
198202
You can see that the Pod is still running:
199203
```shell
200204
kubectl get pods
201205
```
202206
```
203-
NAME READY STATUS RESTARTS AGE
204-
static-web-my-node1 1/1 Running 0 12s
207+
NAME READY STATUS RESTARTS AGE
208+
static-web 1/1 Running 0 4s
205209
```
206210
207-
Back on your node where the kubelet is running, you can try to stop the Docker
208-
container manually.
211+
Back on your node where the kubelet is running, you can try to stop the container manually.
209212
You'll see that, after a time, the kubelet will notice and will restart the Pod
210213
automatically:
211214
212215
```shell
213216
# Run these commands on the node where the kubelet is running
214-
docker stop f6d05272b57e # replace with the ID of your container
217+
crictl stop 129fd7d382018 # replace with the ID of your container
215218
sleep 20
216-
docker ps
217-
```
219+
crictl ps
218220
```
219-
CONTAINER ID IMAGE COMMAND CREATED ...
220-
5b920cbaf8b1 nginx:latest "nginx -g 'daemon of 2 seconds ago ...
221+
```console
222+
CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID
223+
89db4553e1eeb docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106
221224
```
222225
223226
## Dynamic addition and removal of static pods
@@ -230,14 +233,13 @@ The running kubelet periodically scans the configured directory (`/etc/kubelet.d
230233
#
231234
mv /etc/kubelet.d/static-web.yaml /tmp
232235
sleep 20
233-
docker ps
236+
crictl ps
234237
# You see that no nginx container is running
235238
mv /tmp/static-web.yaml /etc/kubelet.d/
236239
sleep 20
237-
docker ps
240+
crictl ps
238241
```
242+
```console
243+
CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID
244+
f427638871c35 docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106
239245
```
240-
CONTAINER ID IMAGE COMMAND CREATED ...
241-
e7a62e3427f1 nginx:latest "nginx -g 'daemon of 27 seconds ago
242-
```
243-

0 commit comments

Comments
 (0)