官术网_书友最值得收藏!

Initialization Pattern

Initialization is a widespread pattern in every part of software engineering, including programming languages and operating systems. In order to handle the initialization of an application in Kubernetes, initialization containers are proposed. Initialization containers, namely initContainers, are part of a pod's definition. Separation of concerns is handled by separating the life cycles of containers:

  • Init containers
  • Main containers

Containers that are defined as initContainers are executed for completion one by one, and they are all expected to exit successfully. After successful completion, the main containers are started. Some of the example uses of startup containers are as follows:

  • To create configuration files
  • To wait and ensure dependency services are available
  • To create volumes and prepare files
  • To register services to discovery systems

In the following activity, a web server will be installed in Kubernetes. As expected, there should be at least one container running the web server. However, there is an additional requirement of changing the served files before the web server starts. The life cycle of these operations is separated into the initialization container and the main container. These containers could have different container images and executables; however, they are expected to work on a shared resource. Life cycle separation and working together issues are handled in the following activity, and the initialization pattern is implemented in Kubernetes.

主站蜘蛛池模板: 白水县| 海阳市| 青神县| 林周县| 米林县| 夏河县| 陇西县| 丹凤县| 东阿县| 界首市| 博乐市| 北海市| 理塘县| 永嘉县| 东丰县| 克东县| 方山县| 江口县| 巴彦县| 江口县| 玉树县| 开鲁县| 阜南县| 农安县| 安丘市| 保康县| 张掖市| 定安县| 鞍山市| 岳阳市| 札达县| 台东市| 阿尔山市| 定陶县| 蒙自县| 长宁县| 延津县| 武平县| 沛县| 二连浩特市| 宣恩县|