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

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.

主站蜘蛛池模板: 伽师县| 尉氏县| 剑河县| 宁安市| 嘉定区| 贵阳市| 金堂县| 土默特右旗| 峨眉山市| 郯城县| 稷山县| 洞口县| 新蔡县| 汕头市| 东明县| 九江县| 民勤县| 嘉义市| 班玛县| 宾川县| 马尔康县| 松溪县| 微山县| 阜新市| 武胜县| 黄山市| 自贡市| 湘乡市| 寿宁县| 莱芜市| 北票市| 潞城市| 敦化市| 夹江县| 邵阳县| 新乐市| 梧州市| 彰武县| 扎兰屯市| 明溪县| 秭归县|