I have setup Docker and microk8s running on Ubuntu WSL. I have pushed a demoapp to private registry running on localhost:5000 and when I try to deploy this demo app image on kubernetes I get imagepull fail stating below error when I describe the pod,
Normal Pulling 18s (x2 over 33s) kubelet Pulling image "localhost:5000/demoapp:latest"
Warning Failed 18s (x2 over 32s) kubelet Failed to pull image "localhost:5000/demoapp:latest": rpc error: code = Unknown desc = failed to pull and unpack image "localhost:5000/demoapp:latest": failed to resolve reference "localhost:5000/demoapp:latest": failed to do request: Head "https://localhost:5000/v2/demoapp/manifests/latest": http: server gave HTTP response to HTTPS client
Warning Failed 18s (x2 over 32s) kubelet Error: ErrImagePull
Normal BackOff 2s (x2 over 31s) kubelet Back-off pulling image "localhost:5000/demoapp:latest"
Warning Failed 2s (x2 over 31s) kubelet Error: ImagePullBackOff
I have perused through quite a few posts about this specific error and most of them lead to either daemon.json not having insecure registry value included or docker not restarted, I have tried both of those but it doesnt seem to help. Any pointers is much appreciated as I have met a wall to things I could try to get this resolved.
I have created the registry with below commands and I am able to query registry both on the shell (via curl) as well as via a browser (albeit with http only) and both localhost and 127.0.0.1 works just fine for :5000/v2/_catalog
docker run -d -p 5000:5000 --restart=always --name registry registry:2
docker tag demoapp:latest localhost:5000/demoapp
docker push localhost:5000/demoapp
my docker info show as below:
# docker info
Client:
Context: default
Debug Mode: false
Server:
Containers: 4
Running: 1
Paused: 0
Stopped: 3
Images: 6
Server Version: 20.10.12
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version:
runc version:
init version:
Security Options:
seccomp
Profile: default
Kernel Version: 5.10.102.1-microsoft-standard-WSL2
Operating System: Ubuntu 20.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 12.38GiB
Name: ADUMMYNAME
ID: BGDY:B54J:7YV6:3GRJ:6YPU:HO5R:ABGC:I2MC:I4MK:FHBI:B5E6:RU6L
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
localhost:5000
127.0.0.0/8
Live Restore Enabled: false
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
My daemon.json looks as below, I have tried both localhost as well as 127.0.0.1, it seem to make no difference, I have made sure to restart docker on each attempt that I tried.
cat /etc/docker/daemon.json
{
"insecure-registries" : ["localhost:5000"]
}