我想让gcr.io/******/serve_model:lat5
Image访问这个变量,它是gcr.io/******/deployservice:lat2
的一个参数
最初,我尝试将变量作为参数传递,但没有成功,因此我尝试将其作为环境变量传递。
我的环境变量将是GCP
存储桶的url,我的serve_model
将从中访问.sav
模型文件。在
name='web-ui',
image='gcr.io/******/deployservice:lat2',
arguments=[
'--image', 'gcr.io/******/serve_model:lat5',
'--name', 'web-ui',
'--container-port', '8080',
'--service-port', '80',
'--service-type', "LoadBalancer"
]
).add_env_variable(V1EnvVar(name='modelurl', value=Model_Path))
add_env_variable()
是Container
对象的函数,它作为ContainerOp
的属性公开。在所以像下面这样的东西就行了。参考kfp dsl代码here
您可以通过检查zip中
^{pr2}$env
部分的YAML来验证这一点将此发布为社区Wiki,以便更好地了解原始海报能够传递此变量。在
这是传递值的最佳
Kubernetes
方式。在您可以用多种方式创建
ConfigMap
(从文件、手动等)。更多信息可在here找到。在解决方案
根据最初的海报评论:
1.使用管道python文件和
container
函数add_env_variable
传递环境变量:web_ui.container.add_env_variable(V1EnvVar(name='modelurl', value=Model_Path))
2命令创建适当的映射。
kubectl create configmap modelurl from-literal=modelurl=Model_Path
3.将上一个命令放入将在
Kubeflow
中使用的脚本。在相关问题 更多 >
编程相关推荐