1. Init (initialize) the container
The Init container is the container that should be run and completed before starting the main container in the container.
-
The application or the main container requires some prerequisites (such as installing some software, database settings, file system permissions before starting).
-
Hope to delay the start of the main container.
It provides a separate life cycle for initialization, so you can separate the concerns in the application.
2. Sidecar (sidecar) container
The sidecar container is a container that runs with the main container in the Pod. Sidecar mode can expand and enhance the functions of the current container without changing it.
-
I want to extend or enhance the functionality of the existing single container Pod but do not want to change the functionality of the existing container Pod.
-
I want to synchronize the main container code with Git server requests.
-
Send log events to an external server.
-
When used for network-related tasks.
Three, Adapter (Adapter) container
In essence, many applications are heterogeneous, which means they do not have the same interface or are inconsistent with other systems.
Imagine a container Pod is running, but it does not have the same interface with other systems because it cannot be integrated or used.
How to make the container have a unified interface in a standardized format so that other systems can connect to the container?
The Adapter container pattern can play a role in this situation.
Four, Ambassador (diplomat) container
The Ambassador container is a special Sidecar container that can simplify Pod external services.
When running applications on kubernetes, there may be external services accessing data. The Ambassador container hides the complexity and provides a unified interface to access these external services.
-
Want to hide the complexity of the main container, such as service discovery (service discovery).
-
When containerized services want to talk to external services, we can use this mode to process the requests and responses of these services.
-
Whenever there is a need to convert or standardize the format of external service responses.
Overview of Kubernetes container design patterns