K8 使用大写镜像名称创建 pod
K8 create pod with uppercase image name
如何创建镜像名称中包含大写字母和连字符的 Kubernetes pod 对象。这可能吗?
我通过在 env 变量中设置它尝试了不同的方法,但没有任何效果?
不,你不能使用大写作为 docker 图像名称,因此你不能在 kubernetes 中使用它。
docker tag 说:
An image name is made up of slash-separated name components,
optionally prefixed by a registry hostname. The hostname must comply
with standard DNS rules, but may not contain underscores. If a
hostname is present, it may optionally be followed by a port number in
the format :8080. If not present, the command uses Docker’s public
registry located at registry-1.docker.io by default. Name components
may contain lowercase letters, digits and separators. A separator is
defined as a period, one or two underscores, or one or more dashes. A
name component may not start or end with a separator.
A tag name must be valid ASCII and may contain lowercase and uppercase
letters, digits, underscores, periods and dashes. A tag name may not
start with a period or a dash and may contain a maximum of 128
characters.
名称组成部分可以包含小写字母、数字和分隔符。此列表中没有大写字母。
您将收到Error parsing reference: "blabla/Hello-world:latest" is not a valid repository/tag: invalid reference format: repository name must be lowercase
感谢您的评论。是的,这个问题在 K8 CKAD 考试中被问到。
我发现有办法,让我更新,
问题是用大写的图像名称创建一个 K8 pod 对象。为此,
使用 'kubectl run nginx --image=nginx'
创建一个常规 pod
现在使用'kubectl set image pod/nginx nginx=Nginx'
重新设置图像名称
使用这种方式你可以设置图片名称中包含大写字母。
是的,我知道 dockerName 不应该是大写的。但我怀疑这个问题背后的意图是确定是否有任何方法可以创建具有大写图像名称的 pod。
如何创建镜像名称中包含大写字母和连字符的 Kubernetes pod 对象。这可能吗?
我通过在 env 变量中设置它尝试了不同的方法,但没有任何效果?
不,你不能使用大写作为 docker 图像名称,因此你不能在 kubernetes 中使用它。
docker tag 说:
An image name is made up of slash-separated name components, optionally prefixed by a registry hostname. The hostname must comply with standard DNS rules, but may not contain underscores. If a hostname is present, it may optionally be followed by a port number in the format :8080. If not present, the command uses Docker’s public registry located at registry-1.docker.io by default. Name components may contain lowercase letters, digits and separators. A separator is defined as a period, one or two underscores, or one or more dashes. A name component may not start or end with a separator.
A tag name must be valid ASCII and may contain lowercase and uppercase letters, digits, underscores, periods and dashes. A tag name may not start with a period or a dash and may contain a maximum of 128 characters.
名称组成部分可以包含小写字母、数字和分隔符。此列表中没有大写字母。
您将收到Error parsing reference: "blabla/Hello-world:latest" is not a valid repository/tag: invalid reference format: repository name must be lowercase
感谢您的评论。是的,这个问题在 K8 CKAD 考试中被问到。 我发现有办法,让我更新,
问题是用大写的图像名称创建一个 K8 pod 对象。为此,
使用 'kubectl run nginx --image=nginx'
创建一个常规 pod现在使用'kubectl set image pod/nginx nginx=Nginx'
重新设置图像名称
使用这种方式你可以设置图片名称中包含大写字母。 是的,我知道 dockerName 不应该是大写的。但我怀疑这个问题背后的意图是确定是否有任何方法可以创建具有大写图像名称的 pod。