https://rancher.com/ logo
#k3d
Title
d

dazzling-zoo-91458

08/18/2022, 7:32 AM
Hi guys! I am fairly new to the whole kubernetes thing but figured it would be good to start labbing with k3d. However, after following the guide for setting up a cluster with a local registry (https://k3d.io/v5.4.4/usage/registries/) I ran into some trouble. The steps I have taken are:
Copy code
k3d registry create registry.localhost --port 12345
k3d cluster create mycluster --registry-use k3d-registry.localhost:12345

docker pull nginx:latest
docker tag nginx:latest k3d-registry.localhost:12345/nginx:latest
docker push k3d-registry.localhost:12345/nginx:latest

cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-test-registry
  labels:
    app: nginx-test-registry
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx-test-registry
  template:
    metadata:
      labels:
        app: nginx-test-registry
    spec:
      containers:
      - name: nginx-test-registry
        image: k3d-registry.localhost:12345/nginx:latest
        ports:
        - containerPort: 80
EOF
No errors so far, but when I run
kubectl describe pod nginx-test-registry
the event log looks like:
Copy code
...

Events:
  Type     Reason                  Age   From               Message
  ----     ------                  ----  ----               -------
  Normal   Scheduled               13s   default-scheduler  Successfully assigned default/nginx-test-registry-5ff799bb8f-6mk6z to k3d-mycluster-server-0
  Warning  FailedCreatePodSandBox  3s    kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to get sandbox image "rancher/mirrored-pause:3.6":
                                                              failed to pull image "rancher/mirrored-pause:3.6": failed to pull and unpack image "<http://docker.io/rancher/mirrored-pause:3.6|docker.io/rancher/mirrored-pause:3.6>": 
                                                                failed to resolve reference "<http://docker.io/rancher/mirrored-pause:3.6|docker.io/rancher/mirrored-pause:3.6>": 
                                                                  failed to do request: Head "<https://registry-1.docker.io/v2/rancher/mirrored-pause/manifests/3.6>": dial tcp: lookup <http://registry-1.docker.io|registry-1.docker.io> on 127.0.0.11:53: read udp 127.0.0.1:34330->127.0.0.11:53: i/o timeout
I reckon that there is a problem with my network config on my host machine but I'm not sure and don't know where to start looking. Any ideas of what my problem is and how to fix it?
w

wide-garage-9465

08/18/2022, 8:15 AM
Hey there! Given that error I assume that there is no pod running at all? What's your OS, Docker Version and network config?
d

dazzling-zoo-91458

08/18/2022, 9:36 AM
That is correct. The pod is stuck in state "ContainerCreating" I'm running
Copy code
Ubuntu 20.04.4 LTS
Docker version 20.10.17, build 100c701
Regarding network config I'm not sure what info you would like to see. Can you specify further? After some experimenting I have found that it works as expected if I connect to the VPN for my office, so it is indeed a network issue. I'm thinking DNS maybe?
Does not seem to be DNS as I thought since I get a timeout. Also nslookup resolves the address. Firewall then?
w

wide-garage-9465

08/18/2022, 10:02 AM
Yeah, I was referring to VPN, DNS, Firewall, etc. It's a Timeout error so Firewall could be the issue. Do you have one running locally (e.g. ufw)? Otherwise any other network firewall could be blocking it.
d

dazzling-zoo-91458

08/18/2022, 11:23 AM
I will continue to look into the matter. I will update this thread when/if I solve it, or if it start looking like I need k3d expertice. Thanks for your help! Much appreciated.
👍 1
613 Views