Skip to content

Commit ec8ea88

Browse files
authored
Merge pull request #31545 from chrisnegus/dockershim-hook-handlers
Updated Debugging Hook handlers example to remove docker reference
2 parents 167cc75 + ccd2fd2 commit ec8ea88

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

content/en/docs/concepts/containers/container-lifecycle-hooks.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,22 @@ The logs for a Hook handler are not exposed in Pod events.
105105
If a handler fails for some reason, it broadcasts an event.
106106
For `PostStart`, this is the `FailedPostStartHook` event,
107107
and for `PreStop`, this is the `FailedPreStopHook` event.
108-
You can see these events by running `kubectl describe pod <pod_name>`.
109-
Here is some example output of events from running this command:
108+
To generate a failed `FailedPreStopHook` event yourself, modify the [lifecycle-events.yaml](https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/lifecycle-events.yaml) file to change the postStart command to "badcommand" and apply it.
109+
Here is some example output of the resulting events you see from running `kubectl describe pod lifecycle-demo`:
110110

111111
```
112112
Events:
113-
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
114-
--------- -------- ----- ---- ------------- -------- ------ -------
115-
1m 1m 1 {default-scheduler } Normal Scheduled Successfully assigned test-1730497541-cq1d2 to gke-test-cluster-default-pool-a07e5d30-siqd
116-
1m 1m 1 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Normal Pulling pulling image "test:1.0"
117-
1m 1m 1 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Normal Created Created container with docker id 5c6a256a2567; Security:[seccomp=unconfined]
118-
1m 1m 1 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Normal Pulled Successfully pulled image "test:1.0"
119-
1m 1m 1 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Normal Started Started container with docker id 5c6a256a2567
120-
38s 38s 1 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Normal Killing Killing container with docker id 5c6a256a2567: PostStart handler: Error executing in Docker Container: 1
121-
37s 37s 1 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Normal Killing Killing container with docker id 8df9fdfd7054: PostStart handler: Error executing in Docker Container: 1
122-
38s 37s 2 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "main" with RunContainerError: "PostStart handler: Error executing in Docker Container: 1"
123-
1m 22s 2 {kubelet gke-test-cluster-default-pool-a07e5d30-siqd} spec.containers{main} Warning FailedPostStartHook
113+
Type Reason Age From Message
114+
---- ------ ---- ---- -------
115+
Normal Scheduled 7s default-scheduler Successfully assigned default/lifecycle-demo to ip-XXX-XXX-XX-XX.us-east-2...
116+
Normal Pulled 6s kubelet Successfully pulled image "nginx" in 229.604315ms
117+
Normal Pulling 4s (x2 over 6s) kubelet Pulling image "nginx"
118+
Normal Created 4s (x2 over 5s) kubelet Created container lifecycle-demo-container
119+
Normal Started 4s (x2 over 5s) kubelet Started container lifecycle-demo-container
120+
Warning FailedPostStartHook 4s (x2 over 5s) kubelet Exec lifecycle hook ([badcommand]) for Container "lifecycle-demo-container" in Pod "lifecycle-demo_default(30229739-9651-4e5a-9a32-a8f1688862db)" failed - error: command 'badcommand' exited with 126: , message: "OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: \"badcommand\": executable file not found in $PATH: unknown\r\n"
121+
Normal Killing 4s (x2 over 5s) kubelet FailedPostStartHook
122+
Normal Pulled 4s kubelet Successfully pulled image "nginx" in 215.66395ms
123+
Warning BackOff 2s (x2 over 3s) kubelet Back-off restarting failed container
124124
```
125125

126126

0 commit comments

Comments
 (0)