在使用' kubectl run'时如何传递图像拉秘密命令? [英] How to pass image pull secret while using 'kubectl run' command?

查看:40
本文介绍了在使用' kubectl run'时如何传递图像拉秘密命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用kubectl run命令从专用注册表中提取图像并从中运行命令.但是我看不到指定图像拉密的选项.似乎无法将图像秘密作为运行命令的一部分传递.

I am trying to use kubectl run command to pull an image from private registry and run a command from that. But I don't see an option to specify image pull secret. It looks like it is not possible to pass image secret as part for run command.

是否还有其他选择可使用kubectl拉容器并运行命令?命令输出应该在控制台上看到.同样,命令完成后,广告连播也会消失.

Is there any alternate option to pull a container and run a command using kubectl? The command output should be seen on the console. Also once the command finishes the pod should die.

推荐答案

如果正确指定,您可以使用覆盖,它是最后一个数组,这使我有点费解,以下内容适用于Kubernetes至少1.6:

You can use the overrides if you specify it right, it's an array in the end, that took me a bit to figure out, the below works on Kubernetes of at least 1.6:

-overrides ='{}]}}}}'

例如

kubectl run -i -t hello-world --rm --generator=run-pod/v1 \
--image=eu.gcr.io/your-registry/hello-world \
--image-pull-policy="IfNotPresent" \
--overrides='{ "spec": { "template": { "spec": { "imagePullSecrets": [{"name": "your-registry-secret"}] } } } }'

这篇关于在使用' kubectl run'时如何传递图像拉秘密命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆