...

/

Multi-Container Pod Example: Init Container

Multi-Container Pod Example: Init Container

Learn about init containers in a multi-container Pod.

We'll cover the following...

Introduction to an init container

The following YAML defines a multi-container Pod with an init container and main app container.

apiVersion: v1
kind: Service
metadata:
  name: k8sbook
spec:
  selector:
    app: initializer
  ports:
    - port: 80
      targetPort: 8080
  type: ClusterIP
Playground

Defining a container under the spec.initContainers block makes it an init container that Kubernetes guarantees will run and complete before regular containers.

Regular app containers are defined ...