何将Configmap添加到StatefulSet中的特定Pod

何将Configmap添加到StatefulSet中的特定Pod

本文介绍了如何将Configmap添加到StatefulSet中的特定Pod?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何将ConfigMap添加到由StatefulSet生成的特定容器中.

I'd like to know how I can add a ConfigMap to a specific pod spawned by a StatefulSet.

我已经查看了规范,但无法弄清楚如何确保Pod只能挂载带有特定标签的ConfigMap.我已经以容器的形式准备好了解决方法.但是,我仍然想知道开箱即用的可能性.

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.

推荐答案

您不能威胁与相同Pod相同的StatefulSet内的Pod.仅仅是因为您只能指定一个对整个集合都有效的PodSpec.

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.

您可以做的是,但是仍然是一个黑客,将所有版本的配置文件安装在每个Pod中,然后运行一个基于Pod名称使用不同配置文件的入口点脚本.我没有要显示的示例,但是应该很容易

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

这篇关于如何将Configmap添加到StatefulSet中的特定Pod?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 21:13