Adding a customized sidecar to a K8S deployment

10/10/2019

I wish to use a Mutating WebHook or Istio to automatically inject a Sidecar container and a shared volume between the existing container and sidecar to a k8s deployment in a remote cluster for log archiving. The issue is that the mount path required for each pod differs and is provided as a user-provided input.

What would be the best way to pass this user-defined information to the webhook?

-- Ranika Nisal
istio
kubernetes
webhooks

1 Answer

10/15/2019

The best place to store that kind of data for the mutating webhook to read from are annotations.

More useful information about annotations and webhooks with examples. Annotations can also be accessed from containers inside a pod.

Note that if the mount path is different for different pods, then we need to get those paths from somewhere.

-- Piotr Malec
Source: StackOverflow