配置私有的镜像仓库
1. 镜像仓库的基本操作
1.1. 登录镜像仓库
docker login -u <username> -p <password> <registry-addr>1.2. 拉取镜像
docker pull https://registry.xxx.com/dev/nginx:latest1.3. 推送镜像
docker push https://registry.xxx.com/dev/nginx:latest1.4. 重命名镜像
docker tag <old-image> <new-image>2. docker.xxx.com镜像仓库
使用docker.xxx.com镜像仓库。
2.1. 所有节点配置insecure-registries
#cat /etc/docker/daemon.json
{
"data-root": "/data/docker",
"debug": false,
"insecure-registries": [
...
"docker.xxx.com:8080"
],
...
}2.2. 所有节点配置/var/lib/kubelet/config.json
具体参考:configuring-nodes-to-authenticate-to-a-private-registry
在某个节点登录docker.xxx.com:8080镜像仓库,会更新 $HOME/.docker/config.json
检查$HOME/.docker/config.json是否有该镜像仓库的auth信息。
将
$HOME/.docker/config.json拷贝到所有的Node节点上的/var/lib/kubelet/config.json。
2.3. 创建docker.xxx.com镜像的pod
指定镜像为:docker.xxx.com:8080/public/2048:latest
完整pod.yaml
查看pod状态
参考:
https://kubernetes.io/docs/concepts/containers/images/#configuring-nodes-to-authenticate-to-a-private-registry
最后更新于
这有帮助吗?