OpenShift Init Container: Difference between revisions
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
* [[OpenShift_Pod_Concepts#Init_Container|OpenShift Pod Concepts]] | * [[OpenShift_Pod_Concepts#Init_Container|OpenShift Pod Concepts]] | ||
* [[Kuberentes Init Containers]] | * [[Kuberentes Init Containers]] | ||
=Declaration= | =Declaration= |
Revision as of 01:28, 19 September 2019
External
- https://kubernetes.io/docs/concepts/workloads/pods/init-containers/
- https://docs.openshift.com/container-platform/latest/architecture/core_concepts/containers_and_images.html#init-containers
Internal
Declaration
Declared within the context of a pod, under the "initContainers" field.
A simple example:
apiVersion: v1 kind: Pod [...] spec: containers: - name: app-container1 [...] initContainers: - name: init-container1 image: busybox command: ['sh', '-c', 'until nslookup myservice; do echo waiting for myservice; sleep 2; done;']
Life Cycle
Timeout
An init container must finish initializing within ... otherwise it puts the deployment into an error state:
NAME READY STATUS RESTARTS AGE a-1-deploy 0/1 Error 0 13m
Resources
Troubleshooting Init Containers
The logs of init containers can be accessed by identifying the name of the init container with:
oc describe po/a-1-0g52b ... Init Containers: b-dependency-checker: ...
and then getting the logs from that specific container:
oc logs -f -c b-dependency-checker po/a-1-0g52b
Application Dependency Example
TODO: write a step-by-step article.