failed to find the sidecar container in Pod spec
DattatrayHinge opened this issue · 16 comments
Hi
I am trying to use examples/static/pv-pvc-deployment.yaml
but when I describe the pod getting below error
MountVolume.SetUp failed for volume "gcs-fuse-csi-pv" : rpc error: code = FailedPrecondition desc = failed to find the sidecar container in Pod spec
Hi @DattatrayHinge , could you check if you put the Pod annotation gke-gcsfuse/volumes: "true"
?
Hi @DattatrayHinge , please use the annotation gke-gcsfuse/ephemeral-storage-limit: 1Gi
to lower the sidecar container ephemeral storage and retry. See https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/cloud-storage-fuse-csi-driver#sidecar-container for details
Hi @DattatrayHinge ,
Yes, please find the solution on the GKE doc:
If you use a Security Context for your Pod or container, or if your container image uses a non-root user or group, you must set the
uid
andgid
mount flags. You also need to use thefile-mode
anddir-mode
mount flags to set the file system permissions. Note that you cannot runchmod
,chown
, orchgrp
commands against a Cloud Storage FUSE file system, souid
,gid
,file-mode
anddir-mode
mount flags are necessary to provide access to a non-root user or group.
HI @songjiaxun , i am facing the rpc error: code = FailedPrecondition desc = failed to find the sidecar container in Pod spec while implementation GCS-CSI Driver and its working fine with nginx pod but not working with deployment yaml.
Note - annotations already added.
Kindly help here.
Hi @guru91197 , can you share the deployment yaml? Please note that for deployment yaml, the annotation needs to be added under the spec.template.metadata.annotations
field.
Hi @DattatrayHinge, are you facing the same issue as @guru91197 reported?
Can you double check if the annotations are under spec.template.metadata.annotations
in a deployment spec? Note that it is not under the deployment annotations, it's under the Pod template annotations.
@DattatrayHinge I don't think the yaml is attached.
Hi @DattatrayHinge I guess GitHub does not allow you to attach an image via email. Can you share the spec yaml directly?
I have been using the driver in existing deployments since Oct 2023 and the annotation was in spec.metadata.annotations. When did it move to spec.template.metadata.annotations? I spent several hours trying to debug a new deployment until I found this thread and moved the annotation to spec.template.metadata.annotations. Now it works!
I have been using the driver in existing deployments since Oct 2023 and the annotation was in spec.metadata.annotations. When did it move to spec.template.metadata.annotations? I spent several hours trying to debug a new deployment until I found this thread and moved the annotation to spec.template.metadata.annotations. Now it works!
I am sorry, I double-checked and the definition in my previous deployments was in spec.template.metadata.annotations.