Skip to content

Commit

Permalink
Merge pull request #48228 from pegasas/issues/47823
Browse files Browse the repository at this point in the history
[SidecarContainer] provide sidecar best practices hints about exit code
  • Loading branch information
k8s-ci-robot authored Nov 2, 2024
2 parents 2abcf8b + 7195f5f commit f9fc6b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions content/en/docs/concepts/workloads/pods/sidecar-containers.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ maintain sidecar containers without affecting the primary application.
Sidecar containers share the same network and storage namespaces with the primary
container. This co-location allows them to interact closely and share resources.

From Kubernetes perspective, sidecars graceful termination is less important.
When other containers took all alloted graceful termination time, sidecar containers
will receive the `SIGTERM` following with `SIGKILL` faster than may be expected.
So exit codes different from `0` (`0` indicates successful exit), for sidecar containers are normal
on Pod termination and should be generally ignored by the external tooling.

## Differences from init containers

Sidecar containers work alongside the main container, extending its functionality and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Using Kubernetes' native support for sidecar containers provides several benefit
special care is needed to handle this situation.
4. Also, with Jobs, built-in sidecar containers would keep being restarted once they are done, even if regular containers would not with Pod's `restartPolicy: Never`.

See [differences from init containers](/docs/concepts/workloads/pods/sidecar-containers/#differences-from-application-containers) to learn more about it.

## Adopting built-in sidecar containers

The `SidecarContainers` [feature gate](/docs/reference/command-line-tools-reference/feature-gates/) is in beta state starting from Kubernetes version 1.29 and is enabled by default.
Expand Down

0 comments on commit f9fc6b4

Please sign in to comment.