From 40afa49efacb9a0225f85b690ea68eaf10d54694 Mon Sep 17 00:00:00 2001 From: Chris Short Date: Wed, 19 Jan 2022 14:16:57 -0500 Subject: [PATCH 1/5] Update static-pod.md Fixes Issue #31394 --- .../docs/tasks/configure-pod-container/static-pod.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/en/docs/tasks/configure-pod-container/static-pod.md b/content/en/docs/tasks/configure-pod-container/static-pod.md index c889570dc7..964770d714 100644 --- a/content/en/docs/tasks/configure-pod-container/static-pod.md +++ b/content/en/docs/tasks/configure-pod-container/static-pod.md @@ -42,7 +42,7 @@ The `spec` of a static Pod cannot refer to other API objects {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} -This page assumes you're using {{< glossary_tooltip term_id="docker" >}} to run Pods, +This page assumes you're using {{< glossary_tooltip term_id="containerd" >}} to run Pods, and that your nodes are running the Fedora operating system. Instructions for other distributions or Kubernetes installations may vary. @@ -156,7 +156,7 @@ already be running. You can view running containers (including static Pods) by running (on the node): ```shell # Run this command on the node where the kubelet is running -docker ps +crictl ps ``` The output might be something like: @@ -213,7 +213,7 @@ automatically: # Run these commands on the node where the kubelet is running docker stop f6d05272b57e # replace with the ID of your container sleep 20 -docker ps +crictl ps ``` ``` CONTAINER ID IMAGE COMMAND CREATED ... @@ -230,11 +230,11 @@ The running kubelet periodically scans the configured directory (`/etc/kubelet.d # mv /etc/kubelet.d/static-web.yaml /tmp sleep 20 -docker ps +crictl ps # You see that no nginx container is running mv /tmp/static-web.yaml /etc/kubelet.d/ sleep 20 -docker ps +crictl ps ``` ``` CONTAINER ID IMAGE COMMAND CREATED ... From d158cdf028b70405eb5858b5676babdd95fa5a7e Mon Sep 17 00:00:00 2001 From: Chris Short Date: Wed, 19 Jan 2022 15:10:45 -0500 Subject: [PATCH 2/5] Removing additional Docker mentions --- content/en/docs/tasks/configure-pod-container/static-pod.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/en/docs/tasks/configure-pod-container/static-pod.md b/content/en/docs/tasks/configure-pod-container/static-pod.md index 964770d714..543eaae167 100644 --- a/content/en/docs/tasks/configure-pod-container/static-pod.md +++ b/content/en/docs/tasks/configure-pod-container/static-pod.md @@ -204,14 +204,13 @@ NAME READY STATUS RESTARTS AGE static-web-my-node1 1/1 Running 0 12s ``` -Back on your node where the kubelet is running, you can try to stop the Docker -container manually. +Back on your node where the kubelet is running, you can try to stop the container manually. You'll see that, after a time, the kubelet will notice and will restart the Pod automatically: ```shell # Run these commands on the node where the kubelet is running -docker stop f6d05272b57e # replace with the ID of your container +crictl stop f6d05272b57e # replace with the ID of your container sleep 20 crictl ps ``` From a819c51c22f1c9856030f327037f2828ff8cb21f Mon Sep 17 00:00:00 2001 From: Chris Short Date: Mon, 24 Jan 2022 14:40:52 -0500 Subject: [PATCH 3/5] Update static-pod.md - Fixed brain flatuence around which runtime I was testing - Outputs changed - Noted added about crictl ps's default behavior of outputting sha256sum in image name - Image name in outputs have been shortened per Slack convo https://kubernetes.slack.com/archives/C02PZMA3R6E/p1643026840047600 --- .../configure-pod-container/static-pod.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/content/en/docs/tasks/configure-pod-container/static-pod.md b/content/en/docs/tasks/configure-pod-container/static-pod.md index 543eaae167..1ad0151e23 100644 --- a/content/en/docs/tasks/configure-pod-container/static-pod.md +++ b/content/en/docs/tasks/configure-pod-container/static-pod.md @@ -42,7 +42,7 @@ The `spec` of a static Pod cannot refer to other API objects {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} -This page assumes you're using {{< glossary_tooltip term_id="containerd" >}} to run Pods, +This page assumes you're using {{< glossary_tooltip term_id="cri-o" >}} to run Pods, and that your nodes are running the Fedora operating system. Instructions for other distributions or Kubernetes installations may vary. @@ -162,18 +162,20 @@ crictl ps The output might be something like: ``` -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -f6d05272b57e nginx:latest "nginx" 8 minutes ago Up 8 minutes k8s_web.6f802af4_static-web-fk-node1_default_67e24ed9466ba55986d120c867395f3c_378e5f3c +CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID +129fd7d382018 docker.io/library/nginx@sha256:... 11 minutes ago Running web 0 34533c6729106 ``` +Note: `crictl` outputs the image URI and SHA-256 checksum. `NAME` will look more like: `docker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31`. + You can see the mirror Pod on the API server: ```shell kubectl get pods ``` ``` -NAME READY STATUS RESTARTS AGE -static-web-my-node1 1/1 Running 0 2m +NAME READY STATUS RESTARTS AGE +static-web 1/1 Running 0 2m ``` {{< note >}} @@ -190,18 +192,18 @@ If you try to use `kubectl` to delete the mirror Pod from the API server, the kubelet _doesn't_ remove the static Pod: ```shell -kubectl delete pod static-web-my-node1 +kubectl delete pod static-web ``` ``` -pod "static-web-my-node1" deleted +pod "static-web" deleted ``` You can see that the Pod is still running: ```shell kubectl get pods ``` ``` -NAME READY STATUS RESTARTS AGE -static-web-my-node1 1/1 Running 0 12s +NAME READY STATUS RESTARTS AGE +static-web 1/1 Running 0 4s ``` Back on your node where the kubelet is running, you can try to stop the container manually. @@ -210,13 +212,13 @@ automatically: ```shell # Run these commands on the node where the kubelet is running -crictl stop f6d05272b57e # replace with the ID of your container +crictl stop 129fd7d382018 # replace with the ID of your container sleep 20 crictl ps ``` ``` -CONTAINER ID IMAGE COMMAND CREATED ... -5b920cbaf8b1 nginx:latest "nginx -g 'daemon of 2 seconds ago ... +CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID +89db4553e1eeb docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 ``` ## Dynamic addition and removal of static pods @@ -236,7 +238,6 @@ sleep 20 crictl ps ``` ``` -CONTAINER ID IMAGE COMMAND CREATED ... -e7a62e3427f1 nginx:latest "nginx -g 'daemon of 27 seconds ago +CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID +f427638871c35 docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 ``` - From 2e812faacf29202436c95a6b06d70f67bc61acab Mon Sep 17 00:00:00 2001 From: Chris Short Date: Wed, 26 Jan 2022 07:14:31 -0500 Subject: [PATCH 4/5] Update static-pod.md Adding console to crictl ps output lines as suggested: https://github.com/kubernetes/website/pull/31410#discussion_r791186773 --- content/en/docs/tasks/configure-pod-container/static-pod.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/docs/tasks/configure-pod-container/static-pod.md b/content/en/docs/tasks/configure-pod-container/static-pod.md index 1ad0151e23..190326065b 100644 --- a/content/en/docs/tasks/configure-pod-container/static-pod.md +++ b/content/en/docs/tasks/configure-pod-container/static-pod.md @@ -161,7 +161,7 @@ crictl ps The output might be something like: -``` +```console CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID 129fd7d382018 docker.io/library/nginx@sha256:... 11 minutes ago Running web 0 34533c6729106 ``` @@ -216,7 +216,7 @@ crictl stop 129fd7d382018 # replace with the ID of your container sleep 20 crictl ps ``` -``` +```console CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID 89db4553e1eeb docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 ``` @@ -237,7 +237,7 @@ mv /tmp/static-web.yaml /etc/kubelet.d/ sleep 20 crictl ps ``` -``` +```console CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID f427638871c35 docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 ``` From 2e870ee7617e3b88b5ad1cdaa82aa0d72560ceeb Mon Sep 17 00:00:00 2001 From: Chris Short Date: Wed, 26 Jan 2022 10:20:32 -0500 Subject: [PATCH 5/5] console no worky; shortening lines --- .../configure-pod-container/static-pod.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/content/en/docs/tasks/configure-pod-container/static-pod.md b/content/en/docs/tasks/configure-pod-container/static-pod.md index 190326065b..fcaa0d9db4 100644 --- a/content/en/docs/tasks/configure-pod-container/static-pod.md +++ b/content/en/docs/tasks/configure-pod-container/static-pod.md @@ -162,11 +162,14 @@ crictl ps The output might be something like: ```console -CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID -129fd7d382018 docker.io/library/nginx@sha256:... 11 minutes ago Running web 0 34533c6729106 +CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID +129fd7d382018 docker.io/library/nginx@sha256:... 11 minutes ago Running web 0 34533c6729106 ``` -Note: `crictl` outputs the image URI and SHA-256 checksum. `NAME` will look more like: `docker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31`. +{{< note >}} +`crictl` outputs the image URI and SHA-256 checksum. `NAME` will look more like: +`docker.io/library/nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31`. +{{< /note >}} You can see the mirror Pod on the API server: @@ -183,7 +186,6 @@ Make sure the kubelet has permission to create the mirror Pod in the API server. [PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/). {{< /note >}} - {{< glossary_tooltip term_id="label" text="Labels" >}} from the static Pod are propagated into the mirror Pod. You can use those labels as normal via {{< glossary_tooltip term_id="selector" text="selectors" >}}, etc. @@ -217,8 +219,8 @@ sleep 20 crictl ps ``` ```console -CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID -89db4553e1eeb docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 +CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID +89db4553e1eeb docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 ``` ## Dynamic addition and removal of static pods @@ -238,6 +240,6 @@ sleep 20 crictl ps ``` ```console -CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID -f427638871c35 docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 +CONTAINER IMAGE CREATED STATE NAME ATTEMPT POD ID +f427638871c35 docker.io/library/nginx@sha256:... 19 seconds ago Running web 1 34533c6729106 ```