-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The sidecar container is at the spec.containers[0] position which may cause issues in some workloads #20
Comments
Here is a workaround with limitations: In order to simulate the sidecar injection achieved by the webhook, you can manually inject the gcsfuse sidecar container at any position in the container array. Meanwhile, you will also need to manually inject an emptyDir. Specifically, you need to specify the following components in your workload:
Here is an example: apiVersion: v1
kind: Pod
metadata:
name: sidecar-test
# Because you are manually injecting the sidecar container,
# you don't need the Pod annotation `gke-gcsfuse/volumes: "true"`.
# Actually, in order to suppress the webhook sidecar injection,
# you must NOT put the Pod annotation.
spec:
serviceAccountName: gcs-csi
containers:
- name: busybox
image: busybox
resources:
limits:
cpu: 250m
ephemeral-storage: 1Gi
memory: 256Mi
requests:
cpu: 250m
ephemeral-storage: 1Gi
memory: 256Mi
command:
- "/bin/sh"
- "-c"
- sleep infinite
volumeMounts:
- name: gcs-fuse-csi-ephemeral
mountPath: /data
# Instead of specifying the sidecar container at the first position in the container array,
# you can inject it at any position.
- name: gke-gcsfuse-sidecar
image: gke.gcr.io/gcs-fuse-csi-driver-sidecar-mounter:v0.1.4-gke.1@sha256:442969f1e565ba63ff22837ce7a530b6cbdb26330140b7f9e1dc23f53f1df335
imagePullPolicy: IfNotPresent
args:
- --v=5
resources:
limits:
cpu: 250m
ephemeral-storage: 1Gi
memory: 256Mi
requests:
cpu: 250m
ephemeral-storage: 1Gi
memory: 256Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65534
runAsNonRoot: true
runAsUser: 65534
seccompProfile:
type: RuntimeDefault
volumeMounts:
- mountPath: /gcsfuse-tmp
name: gke-gcsfuse-tmp
volumes:
- name: gcs-fuse-csi-ephemeral
csi:
driver: gcsfuse.csi.storage.gke.io
volumeAttributes:
bucketName: <your-bucket-name> # unique bucket name
- emptyDir: {}
name: gke-gcsfuse-tmp Limitations
|
The KEP for sidecar container pattern https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/753-sidecar-containers is implemented and merged: kubernetes/kubernetes#116429
This change can be a good solution. |
Hey @songjiaxun, since kubernetes/kubernetes#116429 is merged, is there any plan to address this issue? |
Hi @daikeshi , yes, we are targeting early April 2024 to adopt the native sidecar container feature starting with GKE 1.29 clusters. |
The new GKE version rollout completed. Starting from GKE To try out the new feature, please upgrade your GKE cluster to Closing this issue for now. |
The current sidecar container injection logic will inject the sidecar container at the
spec.containers[0]
position in a Pod.The design makes sure that kubelet or the container runtime will start up the sidecar container first to obtain the file descriptor of the mount point. Otherwise, the other containers that consume the mount point will hang in the start up step.
This design may break some application's assumption, for example, the Airflow Kubernetes Executor assumes that the
base
container is always at thespec.containers[0]
position in the worker Pod, which conflicts with the sidecar container injection logic.We are waiting for the KEP for sidecar container pattern: kubernetes/enhancements#3761. After the KEP is accepted and implemented, we will migrate to leverage the native supported sidecar container pattern.
A workaround is to modify the workload Pod to manually inject the sidecar container. Then the sidecar container can be at any position in the container array. However, if the sidecar container is at a later position than the workload container that consumes the volume, the workload container start up will hang 2 minutes and timeout. But the sidecar container start up will proceed. Whenever the sidecar container starts up, the workload container can start as usual.
The text was updated successfully, but these errors were encountered: