How to trust an insecure image registry?
Problem description
The image registry hosting platform component images may not provide HTTPS service or may not have a valid TLS certificate issued by a public certificate authority. The steps below configure Containerd to skip TLS verification for one registry address. They do not install a CA certificate, and they do not save a username or password on the node.
Use the real host[:port] from the import procedure, including the port when the image reference includes one. Do not use cpaas-registry.cpaas-system. Skipping verification for that logical name does not cover pulls from the real endpoint. If the cluster is already imported, use the registry host in the Sentry Pod image reference when it differs from the address printed on the global cluster.
Platform components authenticate with an image pull secret created from the credentials entered during import. The secret's authentication key is the same real address. These steps do not create that secret.
Configure Containerd to skip TLS verification
Notes:
- All nodes that need to use images, including newly added nodes, must be configured and have Containerd restarted.
- The configuration differs slightly between Containerd v1.4/v1.5 and v1.6. Follow the appropriate steps for your version.
- After Containerd restarts, pull the Sentry image on an imported node. A successful
curlon the global cluster does not prove that the imported node can pull the image.
-
Run the following on every node in the import cluster:
-
Back up the configuration file
-
Get the Containerd runtime version
-
-
Run the following on every node in the import cluster:
-
Edit
/etc/containerd/config.toml -
Restart Containerd.
-
-
Run the following on every node in the import cluster:
-
Check whether
config_pathexists in the config. -
Create the
hosts.tomlfile.If the previous command printed
Follow the steps in "Containerd v1.4 v1.5 configuration for insecure registries"., see Containerd v1.4 v1.5 configuration for insecure registries. -
Restart Containerd.
-