root@rancher-server:/etc/rancher/k3s# systemctl restart k3s.service
root@rancher-server:/etc/rancher/k3s# crictl pull 192.168.50.119/library/alpine
Image is up to date for sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e
root@rancher-server:/etc/rancher/k3s# crictl pull reg.test.com/library/alpine
Image is up to date for sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e
root@rancher-server:/etc/rancher/k3s#
注意: mirror 名称也可以设置为 * , 表示适配任意的仓库名称来获取到镜像,比如:
root@rancher-server:/etc/rancher/k3s# crictl pull 1.1.1.2/library/alpine
Image is up to date for sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e
root@rancher-server:/etc/rancher/k3s# crictl pull 1.1.1.3/library/alpine
Image is up to date for sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e
root@rancher-server:/etc/rancher/k3s# crictl pull x.x.x.x/library/alpine
Image is up to date for sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e
root@rancher-server:/etc/rancher/k3s# crictl pull x.x.x.3x/library/alpine
Image is up to date for sha256:a24bb4013296f61e89ba57005a7b3e52274d8edd3ae2077d04395f806b63d83e
root@rancher-server:/etc/rancher/k3s#
cat >> /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
"192.168.50.119":
endpoint:
- "https://192.168.50.119"
configs:
"192.168.50.119":
tls:
ca_file: # path to the ca file used in the registry
EOF
systemctl restart k3s
cat >> /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
"192.168.50.119":
endpoint:
- "https://192.168.50.119"
configs:
"192.168.50.119":
tls:
cert_file: # path to the cert file used in the registry
key_file: # path to the key file used in the registry
ca_file: # path to the ca file used in the registry
EOF
systemctl restart k3s
DIRECTIVE
DESCRIPTION
cert_file
The client certificate path that will be used to authenticate with the registry
key_file
The client key path that will be used to authenticate with the registry
ca_file
Defines the CA certificate path to be used to verify the registry’s server cert file
cat >> /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
"192.168.50.119":
endpoint:
- "https://192.168.50.119"
configs:
"192.168.50.119":
auth:
username: xxxxxx # this is the registry username
password: xxxxxx # this is the registry password
tls:
cert_file: # path to the cert file used in the registry
key_file: # path to the key file used in the registry
ca_file: # path to the ca file used in the registry
EOF
systemctl restart k3s
mirrors:
"192.168.50.119":
endpoint:
- "http://192.168.50.119"
"docker.io":
endpoint:
- "https://7bezldxe.mirror.aliyuncs.com"
- "https://registry-1.docker.io"
configs:
"192.168.50.119":
auth:
username: '' # this is the registry username
password: '' # this is the registry password
tls:
cert_file: '' # path to the cert file used in the registry
key_file: '' # path to the key file used in the registry
ca_file: '' # path to the ca file used in the registry
"docker.io":
auth:
username: '' # this is the registry username
password: '' # this is the registry password
tls:
cert_file: '' # path to the cert file used in the registry
key_file: '' # path to the key file used in the registry
ca_file: '' # path to the ca file used in the registry