How to add a Configmap to a specific Pod In a StatefulSet?

北城以北 提交于 2019-12-22 14:39:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!