K3d: [BUG] Unable to create cluster on Mac

Created on 6 Oct 2020  路  13Comments  路  Source: rancher/k3d

What did you do

  • How was the cluster created?

    • k3d cluster create k3d-rancher
  • What did you do afterwards?

What did you expect to happen

Expect a cluster will be created

Screenshots or terminal output

kahoulei@kahous-mbp ~ % k3d --version
k3d version v3.1.0
k3s version latest (default)
kahoulei@kahous-mbp ~ % k3d cluster create k3d-rancher
INFO[0000] Created network 'k3d-k3d-rancher'
INFO[0000] Created volume 'k3d-k3d-rancher-images'
INFO[0001] Creating node 'k3d-k3d-rancher-server-0'
INFO[0001] Creating LoadBalancer 'k3d-k3d-rancher-serverlb'
ERRO[0004] Failed to get HostIP
ERRO[0004] Logs from failed access process:
Server:     127.0.0.11
Address:    127.0.0.11:53

Non-authoritative answer:
Name:   host.docker.internal
Address: 192.168.65.2

** server can't find host.docker.internal: NXDOMAIN

ERRO[0004] Failed to create cluster >>> Rolling Back
INFO[0004] Deleting cluster 'k3d-rancher'
INFO[0004] Deleted k3d-k3d-rancher-server-0
INFO[0004] Deleted k3d-k3d-rancher-serverlb
INFO[0004] Deleting cluster network 'f60ecc4a31f58517f88d89419d966e26ce08f6cc87c4260671b9f0cdac7769bd'
FATA[0004] Cluster creation FAILED, all changes have been rolled back!

Which OS & Architecture

  • MacOS

Which version of k3d

kahoulei@kahous-mbp ~ % k3d --version
k3d version v3.1.0
k3s version latest (default)

Which version of docker

  • Docker version 19.03.13, build 4484c46d9d
bug

Most helpful comment

Works now with v3.1.2-beta.0 :)

All 13 comments

Having same issue. Worked fine on 3.0.1, but after upgrade to 3.1.0, I encounter the error above.

Hi, thanks for opening this issue.
This is clearly a bug in the access process.
Please use the --no-hostip flag for now as a workaround 馃憤

Cool it works. Thanks.

Hey @retr0h & @kahou82 , can you please give https://github.com/rancher/k3d/releases/tag/v3.1.1 a try and let me know, if it works for you without the --no-hostip flag?
If no, can you please paste the logs of a run with enabled trace logging (--trace) here?

Just tested this out, it's currently working with the flag for me.

@Brucius

Just tested this out, it's currently working with the flag for me.

Does it still not work with v3.1.1 (without the --no-hostip flag)?

INFO[0007] (Optional) Trying to get IP of the docker host and inject it into the cluster as 'host.k3d.internal' for easy access 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x416a38b]

goroutine 1 [running]:
bufio.(*Reader).Read(0x0, 0xc000357000, 0x1000, 0x1000, 0x30, 0x30, 0x4b851e0)
        bufio/bufio.go:206 +0xab
bufio.(*Scanner).Scan(0xc000829268, 0x4d155c0)
        bufio/scan.go:214 +0xa9
github.com/rancher/k3d/v3/pkg/cluster.resolveHostnameFromInside(0x4d155c0, 0xc0000360a0, 0x4d25320, 0x52ff700, 0xc0003c9b80, 0x4bde536, 0x14, 0x41f9765, 0xc000130040, 0x4bc1260, ...)
        github.com/rancher/k3d/v3/pkg/cluster/host.go:83 +0x21e
github.com/rancher/k3d/v3/pkg/cluster.GetHostIP(0x4d155c0, 0xc0000360a0, 0x4d25320, 0x52ff700, 0xc000418700, 0x0, 0x0, 0x0, 0x0, 0x0)
        github.com/rancher/k3d/v3/pkg/cluster/host.go:60 +0x17e
github.com/rancher/k3d/v3/pkg/cluster.ClusterCreate(0x4d155c0, 0xc0000360a0, 0x4d25320, 0x52ff700, 0xc000418700, 0x0, 0x0)
        github.com/rancher/k3d/v3/pkg/cluster/cluster.go:363 +0x17b5
github.com/rancher/k3d/v3/cmd/cluster.NewCmdClusterCreate.func1(0xc000402b00, 0xc000404640, 0x0, 0x2)
        github.com/rancher/k3d/v3/cmd/cluster/clusterCreate.go:83 +0x14c
github.com/spf13/cobra.(*Command).execute(0xc000402b00, 0xc000404620, 0x2, 0x2, 0xc000402b00, 0xc000404620)
        github.com/spf13/[email protected]/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x52bfd40, 0xc0000320b0, 0x4, 0x4)
        github.com/spf13/[email protected]/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:887
github.com/rancher/k3d/v3/cmd.Execute()
        github.com/rancher/k3d/v3/cmd/root.go:91 +0x5a
main.main()
        github.com/rancher/k3d/v3/main.go:27 +0x25

with v3.1.1 and without --no-hostip flag. Works with the flag.

@sasumaki oh, sorry for that ugly bug and thanks for reporting!
Can you please try with https://github.com/rancher/k3d/releases/tag/v3.1.2-beta.0 ?

Works now with v3.1.2-beta.0 :)

Thanks for testing @sasumaki ! :)
Does it show any warning or other log message saying, that getting the host IP failed? (Just curiosity)

 k3d cluster create -a 2
INFO[0000] Created network 'k3d-k3s-default'            
INFO[0000] Created volume 'k3d-k3s-default-images'      
INFO[0001] Creating node 'k3d-k3s-default-server-0'     
INFO[0003] Pulling image 'docker.io/rancher/k3s:v1.18.9-k3s1' 
INFO[0007] Creating node 'k3d-k3s-default-agent-0'      
INFO[0008] Creating node 'k3d-k3s-default-agent-1'      
INFO[0009] Creating LoadBalancer 'k3d-k3s-default-serverlb' 
INFO[0011] Pulling image 'docker.io/rancher/k3d-proxy:v3.1.2-beta.0' 
INFO[0017] (Optional) Trying to get IP of the docker host and inject it into the cluster as 'host.k3d.internal' for easy access 
INFO[0024] Cluster 'k3s-default' created successfully!  
INFO[0024] You can now use it like this:                
kubectl cluster-info

Thanks @sasumaki !
I also added additional log output now (coming in the next version) to make it clear if it worked or not :+1:

Thanks a lot for your feedback here folks" :+1:

@Brucius

Just tested this out, it's currently working with the flag for me.

Does it still not work with v3.1.1 (without the --no-hostip flag)?

I am on v3.1.0

k3d version v3.1.0
k3s version latest (default)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwhb picture jwhb  路  3Comments

sfriedel picture sfriedel  路  6Comments

JohnnyCrazy picture JohnnyCrazy  路  3Comments

rpocase picture rpocase  路  3Comments

blaggacao picture blaggacao  路  5Comments