minikube pull image x509: certificate relies on legacy Common Name field,

Viewed 5336

I have a docker private registry.Now I want to pull image in minikube

kubectl run test --image=docker-registry.localdomain/others/test:latest --port=8077 --generator=run/v1

but I get an error

Failed to pull image "docker-registry.localdomain/others/test:latest": rpc error: code = Unknown desc = Error response from daemon: Get "https://docker-registry.localdomain/v2/": x509: certificate relies on legacy Common Name field, use SANs or temporarily enable Common Name matching with GODEBUG=x509ignoreCN=0.

And I have try

export GODEBUG=x509ignoreCN=0; kubectl run test --image=docker-registry.localdomain/others/test:latest --port=8077 --generator=run/v1

But I still get the same error.

So how can I deploy this image by minikube?

PS: I can pull this image by docker pull

2 Answers

Solution :
1.Create new certificates in docker registry using :

openssl req -x509 -out registry.crt -keyout registry.key -days 1825 \
  -newkey rsa:2048 -nodes -sha256 \
  -subj '/CN=your-retistry.com' -extensions EXT -config <( \
   printf "[dn]\nCN=your-retistry.com\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:your-retistry.com\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth")

Reference

You can add the registry to insecure-registries list in you docker config file as explained in this solution. Please be aware that this is a workaround if you don't want to fix the certificate.

Related