问题
I'd like to know how I can add a ConfigMap to a specific pod spawned by a StatefulSet.
I've looked at the spec and I can't figure out how to ensure that a pod only mounts a ConfigMap with a specific label. I've already got a workaround ready in the form of a container. However I'd still like to know if this is possible out of the box.
回答1:
You can't threat a pod inside the same StatefulSet as a special pod. Simply because you can only specify a single PodSpec
that's valid for the whole set.
What you could do, but it is still an hack, is mount all versions of the config files in every pod and run an entrypoint script that uses a different config file based on the pod name. I have no example to show but it should be quite easy
来源:https://stackoverflow.com/questions/48384602/how-to-add-a-configmap-to-a-specific-pod-in-a-statefulset