You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SideCar containers have always been used in some ways but just not formally identified as such, they are becoming more common in a lot of applications and as more people have used them, more issues have cropped up.
137
-
138
-
Here are some examples of the main problems:
139
-
140
-
### Jobs
141
-
If you have a Job with two containers one of which is actually doing the main processing of the job and the other is just facilitating it, you encounter a problem when the main process finishes; your sidecar container will carry on running so the job will never finish.
142
-
143
-
The only way around this problem is to manage the sidecar container's lifecycle manually and arrange for it to exit when the main container exits. This is typically achieved by building an ad-hoc signalling mechanism to communicate completion status between containers. Common implementations use a shared scratch volume mounted into all pods, where lifecycle status can be communicated by creating and watching for the presence of files. This pattern has several disadvantages:
144
-
145
-
* Repetitive lifecycle logic must be rewritten in each instance a sidecar is deployed.
146
-
* Third-party containers typically require a wrapper to add this behaviour, normally provided via an entrypoint wrapper script implemented in the k8s container spec. This adds undesirable overhead and introduces repetition between the k8s and upstream container image specs.
147
-
* The wrapping typically requires the presence of a shell in the container image, so this pattern does not work for minimal containers which ship without a toolchain.
148
-
149
-
### Startup
150
-
An application that has a proxy container acting as a sidecar may fail when it starts up as it's unable to communicate until its proxy has started up successfully. Readiness probes don't help if the application is trying to talk outbound.
151
-
152
-
### Shutdown
153
-
Applications that rely on sidecars may experience a high amount of errors when shutting down as the sidecar may terminate before the application has finished what it's doing.
154
-
136
+
The concept of sidecar containers has been around almost since Kubernetes early
137
+
days. A clear example is [this Kubernetes blog post][sidecar-blog-post] from
138
+
2015 mentioning the sidecar pattern.
139
+
140
+
Over the years the sidecar pattern has become more common in applications,
141
+
gained popularity and uses cases are getting more diverse. The current
142
+
Kubernetes primitives handled that well, but they are starting to fall short for
143
+
several use cases and force weird work-arounds in the applications.
144
+
145
+
This proposal aims to remediate that by adding a simple set of guarantees for
146
+
sidecar containers, while trying to not do a complete re-implementation of an
147
+
init system to do so. Those alternatives are interesting and were considered,
148
+
but in the end the community decided to go for something simpler that will cover
149
+
most of the use cases. Those options are explored in the
150
+
[alternatives](#alternatives) section.
151
+
152
+
The next section expands on what the current problems are. But, to give more
153
+
context, it is important to highlight that some companies are already using a
154
+
fork of Kubernetes with this sidecar functionality added (not all
155
+
implementations are the same, but more than one company has a fork for this).
0 commit comments