<p>将此发布为社区Wiki,以便更好地了解原始海报能够传递此变量。在</p>
<p>这是传递值的最佳<code>Kubernetes</code>方式。在</p>
<blockquote>
<p><a href="https://matthewpalmer.net/kubernetes-app-developer/articles/ultimate-configmap-guide-kubernetes.html" rel="nofollow noreferrer">ConfigMap</a> is a dictionary of configuration settings. This
dictionary consists of key-value pairs of strings. Kubernetes provides
these values to your containers. ConfigMap stores configuration
settings for your code. Store connection strings, public credentials,
hostnames, and URLs in your ConfigMap.</p>
</blockquote>
<p>您可以用多种方式创建<code>ConfigMap</code>(从文件、手动等)。更多信息可在<a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#create-a-configmap" rel="nofollow noreferrer">here</a>找到。在</p>
<p><strong>解决方案</strong></p>
<p>根据最初的海报评论:</p>
<p><strong>1.</strong>使用管道python文件和<code>container</code>函数<code>add_env_variable</code>传递环境变量:</p>
<p><code>web_ui.container.add_env_variable(V1EnvVar(name='modelurl', value=Model_Path))</code></p>
<p><strong使用<strong>2命令创建适当的映射。<strong></p>
<p><code>kubectl create configmap modelurl from-literal=modelurl=Model_Path</code></p>
<p><strong>3.</strong>将上一个命令放入将在<code>Kubeflow</code>中使用的脚本。在</p>