k3d: [BUG] WSL2: `host.k3d.internal` warning & failed kubectl connection at 0.0.0.0
What did you do
- How was the cluster created?
root@a15b1a032249:/etc# k3d cluster create
INFO[0000] Prep: Network
INFO[0000] Created network 'k3d-k3s-default'
INFO[0000] Created volume 'k3d-k3s-default-images'
INFO[0000] Starting new tools node...
INFO[0001] Creating node 'k3d-k3s-default-server-0'
INFO[0001] Starting Node 'k3d-k3s-default-tools'
INFO[0001] Creating LoadBalancer 'k3d-k3s-default-serverlb'
INFO[0001] Using the k3d-tools node to gather environment information
WARN[0001] failed to resolve 'host.docker.internal' from inside the k3d-tools node: Failed to read address for 'host.docker.internal' from command output
INFO[0001] HostIP: using network gateway...
INFO[0001] Starting cluster 'k3s-default'
INFO[0001] Starting servers...
INFO[0001] Starting Node 'k3d-k3s-default-server-0'
INFO[0006] Starting agents...
INFO[0006] Starting helpers...
INFO[0006] Starting Node 'k3d-k3s-default-serverlb'
INFO[0012] Injecting '172.25.0.1 host.k3d.internal' into /etc/hosts of all nodes...
INFO[0012] Injecting records for host.k3d.internal and for 2 network members into CoreDNS configmap...
INFO[0012] Cluster 'k3s-default' created successfully!
INFO[0012] You can now use it like this:
kubectl cluster-info
- What did you do afterwards?
root@a15b1a032249:/etc# kubectl cluster-info
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
The connection to the server 0.0.0.0:35545 was refused - did you specify the right host or port?
root@a15b1a032249:/etc# k3d cluster list
NAME SERVERS AGENTS LOADBALANCER
k3s-default 1/1 0/0 true
What did you expect to happen
kubectl cluster-info can work.
Screenshots or terminal output
Which OS & Architecture
My OS is win10,docker run in wsl2,I use dind mode to install k3d,I runing k3d container by docker run ... -v /var/run/docker.sock:/var/run/docker.sock ...,Therefore, K3D and nodes(k3d cluster node) are running at the same level.

Which version of k3d
k3d version v5.1.0
k3s version v1.21.5-k3s2 (default)
Which version of docker
# docker info
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
scan: Docker Scan (Docker Inc., v0.9.0)
Server:
Containers: 5
Running: 3
Paused: 0
Stopped: 2
Images: 13
Server Version: 20.10.8
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: e25210fe30a0a703442421b0f60afac609f950a3
runc version: v1.0.1-0-g4144b63
init version: de40ad0
Security Options:
seccomp
Profile: default
Kernel Version: 5.4.72-microsoft-standard-WSL2
Operating System: Docker Desktop
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 12.28GiB
Name: docker-desktop
ID: SGGV:JZ4Z:7COP:ZETH:HBQL:ULGE:AGQJ:C3DU:HXA7:7DO2:C337:MZHX
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 20 (5 by maintainers)
The way I fixed the issue on my end (without modifying kubeconfig) was to modify the coredns config-map. I ran this command first
Which returns the hostIP as seen from the docker VM. The IP was
192.168.65.2for me. I then set the host.k3d.internal field of the coredns config-map to this value.@kslacroix 