Open borajuanjo opened 2 years ago
Very same here. Running on Azure Kubernetes with K8s v1.23.5
Got the same issue on AWS EKS v1.21, but made it to work. Looks like main problem lies in MutatingWebhookConfiguration
. In original example manifests, webhook config had
apiVersion: admissionregistration.k8s.io/v1beta1
which was refused by K8s in my case, had to modify it to
apiVersion: admissionregistration.k8s.io/v1
To conform with K8s requirements for this API version, I had to add additional keys for sideEffects:
and admissionReviewVersions:
(K8s docs here).
Two WAG's followed :: first one for sideEffects
where i put 'None', second one for admissionReviewVersions
where i started with 'v1'. This led to successful deployment of MutatingWebhookConfiguration
, but the sidecars were not being added to test pods / deployments, same as for both of you. Search through codebase got me to webhook.go line 613 ::
admissionReview := v1beta1.AdmissionReview{}
Change of admissionReviewVersions
from v1
to v1beta1
got the problem solved, sidecar started as expected.
Here's a gist with example mutating-webhook-configuration.yaml
Hope this helps.
So helpful! Thank you! I also had this issue.
I've taken your image updates and pushed it to docker hub if anyone else would like to use it. mindovermiles262/sidecar-injector
Change the deployment.yaml
image to:
spec:
template:
spec:
containers:
- name: "k8s-sidecar-injector"
[ ... ]
# image: tumblr/k8s-sidecar-injector:latest <-- Comment this line out, and update
image: mindovermiles262/sidecar-injector
Note, this image works with the updated mutating webhook configuration where the apiVersion: admissionregistration.k8s.io/v1
and webhooks.sideEffects: None
What's going on?
PODs are not getting sidecars, even though the injection is requested. Funnily I got it to work once on a training cluster, and then I deleted the cluster and I can't get it to work again.
Expected Behavior
PODs should get created with sidecar.
Reproducer
I just went through the documentation step by step, and I can't identify what I'm doing wrong, or what I did differently that one time I got it to work.
Here are some logs for when the
debian-debug
POD gets deployed, but no sidecar.Here's the
debian-debug
POD with no sidecar.Version Deets
Kubernetes Version:
k8s-sidecar-injector
Version:latest
(as of March 23rd 2022)