| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Command supervisor for coordinated Kubernetes pod container termination.
Kubernetes supports multiple containers in a pod, but there is no current feature to manage dependency ordering, so all the containers (other than init containers) start at the same time. This can cause a number of issues with certain configurations, some of which kubexit is designed to mitigate.
kubexit automatically carves (writes to disk) a tombstone (${KUBEXIT_GRAVEYARD}/${KUBEXIT_NAME}) to mark the birth and death of the process it supervises:
These tombstones are written to the graveyard, a folder on the local file system. In Kubernetes, an in-memory volume can be used to share the graveyard between containers in a pod. By watching the file system inodes in the graveyard, kubexit will know when the other containers in the pod start and stop.
Tombstone Content:
Born: <timestamp> Died: <timestamp> ExitCode: <int>
With kubexit, you can define birth dependencies between processes that are wrapped with kubexit and configured with the same graveyard.
Unlike death dependencies, birth dependencies only work within a Kubernetes pod, because kubexit watches pod container readiness, rather than implementing its own readiness checks.
Kubexit will block the execution of the dependent container process (ex: a stateless webapp) until the dependency container (ex: a sidecar proxy) is ready.
The primary use case for this feature is Kubernetes sidecar proxies, where the proxy needs to come up before the primary container process, otherwise the primary process egress calls will fail unitl the proxy is up.
With kubexit, you can define death dependencies between processes that are wrapped with kubexit and configured with the same graveyard.
If the dependency process (ex: a stateless webapp) exits before the dependent process (ex: a sidecar proxy), kubexit will detect the tombstone update (Died: <timestamp>) and send the TERM signal to the dependent process.
The primary use case for this feature is Kubernetes Jobs, where a sidecar container needs to be gracefully shutdown when the primary container exits, otherwise the Job will never complete.
kubexit is configured with environment variables only, to make it easy to configure in Kubernetes and minimize entrypoint/command changes.
Tombstone:
Death Dependency:
Birth Dependency:
While kubexit can easily be installed on your local machine, the primary use cases require execution within Kubernetes pod containers. So the recommended method of installation is to either side-load kubexit using a shared volume and an init container, or build kubexit into your own container images.
Build from source:
go get github.com/karlkfi/kubexit/cmd/kubexit
Copy from pre-built Alpine-based container image in a multi-stage build:
FROM karlkfi/kubexit:latest AS kubexit FROM alpine:3.11 RUN apk --no-cache add ca-certificates tzdata COPY --from=kubexit /bin/kubexit /bin/ ENTRYPOINT ["kubexit"]
Copy from init container to ephemeral volume:
volumes:
- name: kubexit
emptyDir: {}
initContainers:
- name: kubexit
image: karlkfi/kubexit:latest
command: ['cp', '/bin/kubexit', '/kubexit/kubexit']
volumeMounts:
- mountPath: /kubexit
name: kubexit
| Back | FazBrowse Home | New Git URL |