简体   繁体   English

如何更改默认的 K8s 集群注册表?

[英]How to change default K8s cluster registry?

How to change our k8s cluster from docker.io to our private registry so we don't have to mention the docker registry host on every image?如何将我们的 k8s 集群从 docker.io 更改为我们的私有注册表,这样我们就不必在每个图像上提及 docker 注册表主机?

This is a Community Wiki answer partially based on other user's comments, so feel free to edit it and add any additional details you consider important.这是一个社区 Wiki 答案,部分基于其他用户的评论,因此请随时对其进行编辑并添加您认为重要的任何其他详细信息。

As you can read in this section of the official kubernetes documentation, it can be configured on a container runtime level ( in this case Docker ) by creating a Secret based on existing Docker credentials and later you can refer to such alternative cofiguration in your Pod specification as follows:正如您可以在官方kubernetes文档的这一部分中阅读的那样,它可以在容器运行时级别(在本例中Docker )通过基于现有 Docker 创建一个Secret Pod配置如下:

apiVersion: v1
kind: Pod
metadata:
  name: private-reg
spec:
  containers:
  - name: private-reg-container
    image: <your-private-image>
  imagePullSecrets: 👈
  - name: regcred

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM