1

K8S need to use private repo by default

I'm currently trying to use Nexus Repo by default for Kubernetes. But I have 2 problems. The first one is that if I don't specify the repository, it will directly search on docker.io, despite the fact that I've specified. Also my K8S is using containerd.

/etc/containerd/config.toml

[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["http://192...:8082"]

Furthermore, even when I specify the image with the repository, there seems to be an issue. It's not a connection problem because I was able to ping the repository.

describe of the pod

Events:
│   Type     Reason     Age    From               Message      
│   ----     ------     ----   ----               -------
│   Normal   Pulling    2m17s  kubelet            Pulling image "repo.mm.mm:8082/nginx:latest"
│   Warning  Failed     2m17s  kubelet            Failed to pull image "repo.mm.mm:8082/nginx:latest": rpc error: code = Unknown desc = failed to pull and unpack image "repo.mm.mm:8082/nginx:latest": failed to resolve reference "repo.mm.mm:8082/nginx:latest": failed to do request: Head "https://repo.mm.mm:8082/v2/nginx/manifests/latest": dial tcp 192...:8082: connect: connection refused
│   Warning  Failed     2m17s  kubelet            Error: ErrImagePull
│   Normal   BackOff    2m17s  kubelet            Back-off pulling image "repo.mm.mm:8082/nginx:latest" 
│   Warning  Failed     2m17s  kubelet            Error: ImagePullBackOff  
│   Normal   Scheduled  2s     default-scheduler  Successfully assigned default/ng-test to worker1  

If anyone has encountered a similar issue or has any suggestions for resolving these problems, your assistance would be highly appreciated. Thank you in advance!

1 Answer 1

0

i just put this here if it can help someone because i found something that works with containerd v2 :

    [plugins."io.containerd.grpc.v1.cri".registry]
      [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
        [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
          endpoint = ["https://your-private-nexus.local"]
      [plugins."io.containerd.grpc.v1.cri".registry.configs]
      [plugins."io.containerd.grpc.v1.cri".registry.configs."your-private-nexus.local".auth]
        auth = "Basic ZG9ja2VxxxxxxxxxUyZWRzIQ==" #<-- username:password|base64
        username = "you-nexus-user"
        password = "xxxxxxxx"

note that 'your-private-nexus.local' land on a reverse-proxy that redirect the request to a nexus on the http port of the cache repository.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.