Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is --pod-infra-container-image meant for?

Tags:

kubernetes

What is purpose of pod-infra-container-image in kubernetes?

Official documentation says only:

The image whose network/ipc namespaces containers in each pod will use. (default "gcr.io/google_containers/pause-amd64:3.0")

but I don't understand exactly what it does and how it works in detail.

like image 911
Sasa Avatar asked Oct 08 '17 11:10

Sasa


People also ask

What is infra container of pod?

Each pod contains an infrastructure container ( INFRA ), whose purpose is to hold the name space. INFRA also enables Podman to add other containers to the pod. Port bindings, cgroup-parent values, and kernel name spaces are all assigned to the infrastructure container.

What is container image in Kubernetes?

A container image represents binary data that encapsulates an application and all its software dependencies. Container images are executable software bundles that can run standalone and that make very well defined assumptions about their runtime environment.

What is a pod vs container?

A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers. A Pod's contents are always co-located and co-scheduled, and run in a shared context.

What is POD and container in Kubernetes?

A Kubernetes pod is a collection of one or more Linux® containers, and is the smallest unit of a Kubernetes application. Any given pod can be composed of multiple, tightly coupled containers (an advanced use case) or just a single container (a more common use case).


2 Answers

The pause container, which image the --pod-infra-container flag selects, is used so that multiple containers can be launched in a pod, while sharing resources. It mostly does nothing, and unless you have a very good reason to replace it with something custom, you shouldn't. It mostly invokes the pause system call (hence its name) but it also performs the important function of having PID 1 and making sure no zombie processes are kept around.

An extremely complete article on the subject can be found here, from where I also shamelessly stole the following picture which illustrates where the pause container lives:

enter image description here

like image 157
vascop Avatar answered Oct 23 '22 03:10

vascop


The pause container is built from https://github.com/kubernetes/kubernetes/tree/master/build/pause . The process itself does nothing so you can replace it with another container of your choice that equally does nothing (with the --pod-infra-container-image parameter of kubelet).

This container is started as a part of each and every pod. Kubernetes is using this well-known, never falling container to setup the network namespace for the pod and make sure the namespace is never empty (all the other containers in the pod might fail). But again, the container process itself does nothing, it's just a placeholder.

like image 37
Janos Lenart Avatar answered Oct 23 '22 02:10

Janos Lenart