Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] k3d-tools already in use by container #924

Closed
arkadius opened this issue Jan 12, 2022 · 7 comments · Fixed by #952
Closed

[BUG] k3d-tools already in use by container #924

arkadius opened this issue Jan 12, 2022 · 7 comments · Fixed by #952
Assignees
Labels
bug Something isn't working
Milestone

Comments

@arkadius
Copy link

From time to time, creation of cluster fail with message Error response from daemon: Conflict. The container name "/k3d-k3s-default-tools" is already in use by container
It looks like k3d-tools is created twice. Second creation (for gathering environment information purpose) finishing with error. Any idea what happen? It looks like k3d-tools is not reuesed or not cleaned up correctly after first creation.

What did you do

  • How was the cluster created?
    • k3d cluster create k3s-default --wait --config=single-cluster.yml --trace

single-cluster.yml content:

apiVersion: k3d.io/v1alpha3
kind: Simple
image: docker.io/rancher/k3s:v1.23.1-k3s1
servers: 1
agents: 1
options:
  k3d:
    wait: true
    timeout: "60s"
    disableLoadbalancer: true
    disableRollback: true
  k3s:
    extraArgs:
      - arg: --no-deploy=traefik,servicelb,metrics-server
        nodeFilters:
          - server:*
  kubeconfig:
    updateDefaultKubeconfig: true
    switchCurrentContext: true
  • What did you do afterwards?
    Nothing - just wait until command finishes

What did you expect to happen

Command will finish with error code 0 and k3d cluster is operating.

Screenshots or terminal output

DEBU[0000] DOCKER_SOCK=/var/run/docker.sock             
DEBU[0000] Runtime Info:
&{Name:docker Endpoint:/var/run/docker.sock Version:20.10.11+azure-3 OSType:linux OS:Ubuntu 20.04.3 LTS Arch:x86_64 CgroupVersion:1 CgroupDriver:cgroupfs Filesystem:extfs} 
DEBU[0000] Additional CLI Configuration:
cli:
  api-port: ""
  env: []
  k3s-node-labels: []
  k3sargs: []
  ports: []
  registries:
    create: ""
  runtime-labels: []
  volumes: [] 
DEBU[0000] Validating file /tmp/k3d-config-tmp-single-cluster.yml2757180638 against default JSONSchema... 
DEBU[0000] JSON Schema Validation Result: &{errors:[] score:81} 
INFO[0000] Using config file .k3d/single-cluster.yml (k3d.io/v1alpha3#simple) 
DEBU[0000] Configuration:
agents: 1
apiversion: k3d.io/v1alpha3
image: docker.io/rancher/k3s:v1.23.1-k3s1
kind: Simple
network: ""
options:
  k3d:
    disableimagevolume: false
    disableloadbalancer: true
    disablerollback: true
    loadbalancer:
      configoverrides: []
    timeout: 60s
    wait: true
  k3s:
    extraargs:
    - arg: --no-deploy=traefik,servicelb,metrics-server
      nodeFilters:
      - server:*
  kubeconfig:
    switchcurrentcontext: true
    updatedefaultkubeconfig: true
  runtime:
    agentsmemory: ""
    gpurequest: ""
    serversmemory: ""
registries:
  config: ""
  use: []
servers: 1
subnet: ""
token: "" 
TRAC[0000] Trying to read config apiVersion='k3d.io/v1alpha3', kind='simple' 
DEBU[0000] ========== Simple Config ==========
{TypeMeta:{Kind:Simple APIVersion:k3d.io/v1alpha3} Name: Servers:1 Agents:1 ExposeAPI:{Host: HostIP: HostPort:} Image:docker.io/rancher/k3s:v1.23.1-k3s1 Network: Subnet: ClusterToken: Volumes:[] Ports:[] Options:{K3dOptions:{Wait:true Timeout:1m0s DisableLoadbalancer:true DisableImageVolume:false NoRollback:true NodeHookActions:[] Loadbalancer:{ConfigOverrides:[]}} K3sOptions:{ExtraArgs:[{Arg:--no-deploy=traefik,servicelb,metrics-server NodeFilters:[server:*]}] NodeLabels:[]} KubeconfigOptions:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true} Runtime:{GPURequest: ServersMemory: AgentsMemory: Labels:[]}} Env:[] Registries:{Use:[] Create:<nil> Config:}}
========================== 
TRAC[0000] VolumeFilterMap: map[]                       
TRAC[0000] PortFilterMap: map[]                         
TRAC[0000] K3sNodeLabelFilterMap: map[]                 
TRAC[0000] RuntimeLabelFilterMap: map[]                 
TRAC[0000] EnvFilterMap: map[]                          
DEBU[0000] ========== Merged Simple Config ==========
{TypeMeta:{Kind:Simple APIVersion:k3d.io/v1alpha3} Name: Servers:1 Agents:1 ExposeAPI:{Host: HostIP: HostPort:44217} Image:docker.io/rancher/k3s:v1.23.1-k3s1 Network: Subnet: ClusterToken: Volumes:[] Ports:[] Options:{K3dOptions:{Wait:true Timeout:1m0s DisableLoadbalancer:true DisableImageVolume:false NoRollback:true NodeHookActions:[] Loadbalancer:{ConfigOverrides:[]}} K3sOptions:{ExtraArgs:[{Arg:--no-deploy=traefik,servicelb,metrics-server NodeFilters:[server:*]}] NodeLabels:[]} KubeconfigOptions:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true} Runtime:{GPURequest: ServersMemory: AgentsMemory: Labels:[]}} Env:[] Registries:{Use:[] Create:<nil> Config:}}
========================== 
DEBU[0000] Disabling the load balancer                  
TRAC[0000] Filtering 2 nodes by [server:*]              
TRAC[0000] Filtered 1 nodes (filter: [server:*])        
DEBU[0000] ===== Merged Cluster Config =====
&{TypeMeta:{Kind: APIVersion:} Cluster:{Name:k3s-default Network:{Name:k3d-k3s-default ID: External:false IPAM:{IPPrefix:zero IPPrefix IPsUsed:[] Managed:false} Members:[]} Token: Nodes:[0xc0003a5200 0xc0003a5380] InitNode:<nil> ExternalDatastore:<nil> KubeAPI:0xc0000a87c0 ServerLoadBalancer:<nil> ImageVolume:} ClusterCreateOpts:{DisableImageVolume:false WaitForServer:true Timeout:1m0s DisableLoadBalancer:true GPURequest: ServersMemory: AgentsMemory: NodeHooks:[] GlobalLabels:map[app:k3d] GlobalEnv:[] Registries:{Create:<nil> Use:[] Config:<nil>}} KubeconfigOpts:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true}}
===== ===== ===== 
DEBU[0000] ===== Processed Cluster Config =====
&{TypeMeta:{Kind: APIVersion:} Cluster:{Name:k3s-default Network:{Name:k3d-k3s-default ID: External:false IPAM:{IPPrefix:zero IPPrefix IPsUsed:[] Managed:false} Members:[]} Token: Nodes:[0xc0003a5200 0xc0003a5380] InitNode:<nil> ExternalDatastore:<nil> KubeAPI:0xc0000a87c0 ServerLoadBalancer:<nil> ImageVolume:} ClusterCreateOpts:{DisableImageVolume:false WaitForServer:true Timeout:1m0s DisableLoadBalancer:true GPURequest: ServersMemory: AgentsMemory: NodeHooks:[] GlobalLabels:map[app:k3d] GlobalEnv:[] Registries:{Create:<nil> Use:[] Config:<nil>}} KubeconfigOpts:{UpdateDefaultKubeconfig:true SwitchCurrentContext:true}}
===== ===== ===== 
DEBU[0000] '--kubeconfig-update-default set: enabling wait-for-server 
INFO[0000] Prep: Network                                
INFO[0000] Created network 'k3d-k3s-default'            
INFO[0000] Created volume 'k3d-k3s-default-images'      
TRAC[0000] Using Registries: []                         
TRAC[0000] 
===== Creating Cluster =====

Runtime:
{}

Cluster:
&{Name:k3s-default Network:{Name:k3d-k3s-default ID:944a1d17900b431ef078f099f2ed4c9deadd2b19bec55f65d63cd0d379d85f9b External:false IPAM:{IPPrefix:172.18.0.0/16 IPsUsed:[] Managed:false} Members:[]} Token: Nodes:[0xc0003a5200 0xc0003a5380] InitNode:<nil> ExternalDatastore:<nil> KubeAPI:0xc0000a87c0 ServerLoadBalancer:<nil> ImageVolume:k3d-k3s-default-images}

ClusterCreatOpts:
&{DisableImageVolume:false WaitForServer:true Timeout:1m0s DisableLoadBalancer:true GPURequest: ServersMemory: AgentsMemory: NodeHooks:[] GlobalLabels:map[app:k3d k3d.cluster.imageVolume:k3d-k3s-default-images k3d.cluster.network:k3d-k3s-default k3d.cluster.network.external:false k3d.cluster.network.id:944a1d17900b431ef078f099f2ed4c9deadd2b19bec55f65d63cd0d379d85f9b k3d.cluster.network.iprange:172.18.0.0/16] GlobalEnv:[] Registries:{Create:<nil> Use:[] Config:<nil>}}

============================
	 
INFO[0000] Starting new tools node...                   
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock             
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock             
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock             
TRAC[0000] Creating node from spec
&{Name:k3d-k3s-default-tools Role:noRole Image:docker.io/rancher/k3d-tools:5.1.0 Volumes:[k3d-k3s-default-images:/k3d/images /var/run/docker.sock:/var/run/docker.sock] Env:[] Cmd:[] Args:[noop] Ports:map[] Restart:false Created: RuntimeLabels:map[app:k3d k3d.cluster:k3s-default k3d.version:v5.1.0] K3sNodeLabels:map[] Networks:[k3d-k3s-default] ExtraHosts:[] ServerOpts:{IsInit:false KubeAPI:<nil>} AgentOpts:{} GPURequest: Memory: State:{Running:false Status: Started:} IP:{IP:zero IP Static:false} HookActions:[]} 
TRAC[0000] Creating docker container with translated config
&{ContainerConfig:{Hostname:k3d-k3s-default-tools Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:false OpenStdin:false StdinOnce:false Env:[K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml] Cmd:[noop] Healthcheck:<nil> ArgsEscaped:false Image:docker.io/rancher/k3d-tools:5.1.0 Volumes:map[] WorkingDir: Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[app:k3d k3d.cluster:k3s-default k3d.role:noRole k3d.version:v5.1.0] StopSignal: StopTimeout:<nil> Shell:[]} HostConfig:{Binds:[k3d-k3s-default-images:/k3d/images /var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode: PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:true PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[/run: /var/run:] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: ConsoleSize:[0 0] Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[] MaskedPaths:[] ReadonlyPaths:[] Init:0xc00021094f} NetworkingConfig:{EndpointsConfig:map[k3d-k3s-default:0xc0002ec180]}} 
INFO[0001] Creating node 'k3d-k3s-default-server-0'     
DEBU[0001] DOCKER_SOCK=/var/run/docker.sock             
TRAC[0001] Creating node from spec
&{Name:k3d-k3s-default-server-0 Role:server Image:docker.io/rancher/k3s:v1.23.1-k3s1 Volumes:[k3d-k3s-default-images:/k3d/images] Env:[K3S_TOKEN=GXewdBGKsDDSnqzlEYKP] Cmd:[] Args:[--no-deploy=traefik,servicelb,metrics-server] Ports:map[6443:[{HostIP:0.0.0.0 HostPort:44217}]] Restart:true Created: RuntimeLabels:map[app:k3d k3d.cluster:k3s-default k3d.cluster.imageVolume:k3d-k3s-default-images k3d.cluster.network:k3d-k3s-default k3d.cluster.network.external:false k3d.cluster.network.id:944a1d17900b431ef078f099f2ed4c9deadd2b19bec55f65d63cd0d379d85f9b k3d.cluster.network.iprange:172.18.0.0/16 k3d.cluster.token:GXewdBGKsDDSnqzlEYKP k3d.cluster.url:https://k3d-k3s-default-server-0:6443] K3sNodeLabels:map[] Networks:[k3d-k3s-default] ExtraHosts:[] ServerOpts:{IsInit:false KubeAPI:0xc0000a87c0} AgentOpts:{} GPURequest: Memory: State:{Running:false Status: Started:} IP:{IP:zero IP Static:false} HookActions:[]} 
DEBU[0001] DockerHost:                                  
TRAC[0001] Creating docker container with translated config
&{ContainerConfig:{Hostname:k3d-k3s-default-server-0 Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[6443:{}] Tty:false OpenStdin:false StdinOnce:false Env:[K3S_TOKEN=GXewdBGKsDDSnqzlEYKP K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml] Cmd:[server --no-deploy=traefik,servicelb,metrics-server --tls-san 0.0.0.0] Healthcheck:<nil> ArgsEscaped:false Image:docker.io/rancher/k3s:v1.23.1-k3s1 Volumes:map[] WorkingDir: Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[app:k3d k3d.cluster:k3s-default k3d.cluster.imageVolume:k3d-k3s-default-images k3d.cluster.network:k3d-k3s-default k3d.cluster.network.external:false k3d.cluster.network.id:944a1d17900b431ef078f099f2ed4c9deadd2b19bec55f65d63cd0d379d85f9b k3d.cluster.network.iprange:172.18.0.0/16 k3d.cluster.token:GXewdBGKsDDSnqzlEYKP k3d.cluster.url:https://k3d-k3s-default-server-0:6443 k3d.role:server k3d.server.api.host:0.0.0.0 k3d.server.api.hostIP:0.0.0.0 k3d.server.api.port:44217 k3d.version:v5.1.0] StopSignal: StopTimeout:<nil> Shell:[]} HostConfig:{Binds:[k3d-k3s-default-images:/k3d/images] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode: PortBindings:map[6443:[{HostIP:0.0.0.0 HostPort:44217}]] RestartPolicy:{Name:unless-stopped MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:true PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[/run: /var/run:] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: ConsoleSize:[0 0] Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[] MaskedPaths:[] ReadonlyPaths:[] Init:0xc0002113df} NetworkingConfig:{EndpointsConfig:map[k3d-k3s-default:0xc0002ec240]}} 
INFO[0001] Pulling image 'docker.io/rancher/k3s:v1.23.1-k3s1' 
INFO[0004] Pulling image 'docker.io/rancher/k3d-tools:5.1.0' 
DEBU[0006] Created container k3d-k3s-default-server-0 (ID: 4640bcbf949adacc154b5f84bf59ad2458bc0f08cfca93edcc91424ff08efdce) 
DEBU[0006] Created node 'k3d-k3s-default-server-0'      
INFO[0006] Creating node 'k3d-k3s-default-agent-0'      
DEBU[0006] DOCKER_SOCK=/var/run/docker.sock             
TRAC[0006] Creating node from spec
&{Name:k3d-k3s-default-agent-0 Role:agent Image:docker.io/rancher/k3s:v1.23.1-k3s1 Volumes:[k3d-k3s-default-images:/k3d/images] Env:[K3S_TOKEN=GXewdBGKsDDSnqzlEYKP K3S_URL=https://k3d-k3s-default-server-0:6443] Cmd:[] Args:[] Ports:map[] Restart:true Created: RuntimeLabels:map[app:k3d k3d.cluster:k3s-default k3d.cluster.imageVolume:k3d-k3s-default-images k3d.cluster.network:k3d-k3s-default k3d.cluster.network.external:false k3d.cluster.network.id:944a1d17900b431ef078f099f2ed4c9deadd2b19bec55f65d63cd0d379d85f9b k3d.cluster.network.iprange:172.18.0.0/16 k3d.cluster.token:GXewdBGKsDDSnqzlEYKP k3d.cluster.url:https://k3d-k3s-default-server-0:6443] K3sNodeLabels:map[] Networks:[k3d-k3s-default] ExtraHosts:[] ServerOpts:{IsInit:false KubeAPI:<nil>} AgentOpts:{} GPURequest: Memory: State:{Running:false Status: Started:} IP:{IP:zero IP Static:false} HookActions:[]} 
TRAC[0006] Creating docker container with translated config
&{ContainerConfig:{Hostname:k3d-k3s-default-agent-0 Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:false OpenStdin:false StdinOnce:false Env:[K3S_TOKEN=GXewdBGKsDDSnqzlEYKP K3S_URL=https://k3d-k3s-default-server-0:6443 K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml] Cmd:[agent] Healthcheck:<nil> ArgsEscaped:false Image:docker.io/rancher/k3s:v1.23.1-k3s1 Volumes:map[] WorkingDir: Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[app:k3d k3d.cluster:k3s-default k3d.cluster.imageVolume:k3d-k3s-default-images k3d.cluster.network:k3d-k3s-default k3d.cluster.network.external:false k3d.cluster.network.id:944a1d17900b431ef078f099f2ed4c9deadd2b19bec55f65d63cd0d379d85f9b k3d.cluster.network.iprange:172.18.0.0/16 k3d.cluster.token:GXewdBGKsDDSnqzlEYKP k3d.cluster.url:https://k3d-k3s-default-server-0:6443 k3d.role:agent k3d.version:v5.1.0] StopSignal: StopTimeout:<nil> Shell:[]} HostConfig:{Binds:[k3d-k3s-default-images:/k3d/images] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode: PortBindings:map[] RestartPolicy:{Name:unless-stopped MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:true PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[/run: /var/run:] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: ConsoleSize:[0 0] Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[] MaskedPaths:[] ReadonlyPaths:[] Init:0xc0002c739f} NetworkingConfig:{EndpointsConfig:map[k3d-k3s-default:0xc0004f40c0]}} 
DEBU[0006] Created container k3d-k3s-default-agent-0 (ID: 4c96cb8632fc6c15642505aebe99189c95c796cd8a72f162eaf1b9b3a58ba071) 
DEBU[0006] Created node 'k3d-k3s-default-agent-0'       
DEBU[0006] DOCKER_SOCK=/var/run/docker.sock             
INFO[0006] Using the k3d-tools node to gather environment information 
INFO[0006] Starting new tools node...                   
DEBU[0006] DOCKER_SOCK=/var/run/docker.sock             
DEBU[0006] DOCKER_SOCK=/var/run/docker.sock             
DEBU[0006] DOCKER_SOCK=/var/run/docker.sock             
TRAC[0006] Creating node from spec
&{Name:k3d-k3s-default-tools Role:noRole Image:docker.io/rancher/k3d-tools:5.1.0 Volumes:[k3d-k3s-default-images:/k3d/images /var/run/docker.sock:/var/run/docker.sock] Env:[] Cmd:[] Args:[noop] Ports:map[] Restart:false Created: RuntimeLabels:map[app:k3d k3d.cluster:k3s-default k3d.version:v5.1.0] K3sNodeLabels:map[] Networks:[k3d-k3s-default] ExtraHosts:[] ServerOpts:{IsInit:false KubeAPI:<nil>} AgentOpts:{} GPURequest: Memory: State:{Running:false Status: Started:} IP:{IP:zero IP Static:false} HookActions:[]} 
TRAC[0006] Creating docker container with translated config
&{ContainerConfig:{Hostname:k3d-k3s-default-tools Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:false OpenStdin:false StdinOnce:false Env:[K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml] Cmd:[noop] Healthcheck:<nil> ArgsEscaped:false Image:docker.io/rancher/k3d-tools:5.1.0 Volumes:map[] WorkingDir: Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[app:k3d k3d.cluster:k3s-default k3d.role:noRole k3d.version:v5.1.0] StopSignal: StopTimeout:<nil> Shell:[]} HostConfig:{Binds:[k3d-k3s-default-images:/k3d/images /var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode: PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:true PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[/run: /var/run:] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: ConsoleSize:[0 0] Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[] MaskedPaths:[] ReadonlyPaths:[] Init:0xc0004ae20f} NetworkingConfig:{EndpointsConfig:map[k3d-k3s-default:0xc0004f4180]}} 
INFO[0006] Pulling image 'docker.io/rancher/k3d-tools:5.1.0' 
DEBU[0006] Created container k3d-k3s-default-tools (ID: c279bac13b063de9dcde06b3af9bf51d6a5e36cfc051f0ce39b345fee61793e0) 
DEBU[0006] Node k3d-k3s-default-tools Start Time: 2022-01-11 17:44:15.466014043 +0000 UTC m=+6.756265963 
TRAC[0006] Starting node 'k3d-k3s-default-tools'        
INFO[0006] Starting Node 'k3d-k3s-default-tools'        
ERRO[0006] Failed to run tools container for cluster 'k3s-default' 
ERRO[0006] failed to gather environment information used for cluster creation: failed to run k3d-tools node for cluster 'k3s-default': failed to create node 'k3d-k3s-default-tools': runtime failed to create node 'k3d-k3s-default-tools': failed to create container for node 'k3d-k3s-default-tools': docker failed to create container 'k3d-k3s-default-tools': Error response from daemon: Conflict. The container name "/k3d-k3s-default-tools" is already in use by container "c279bac13b063de9dcde06b3af9bf51d6a5e36cfc051f0ce39b345fee61793e0". You have to remove (or rename) that container to be able to reuse that name. 
FATA[0006] Cluster creation FAILED, rollback deactivated. 
Error: Process completed with exit code 1.

Which OS & Architecture

Cluster was being created on github acitons workers. Job creating it: https://github.com/TouK/nussknacker/runs/4779179444?check_suite_focus=true
Os: Ubuntu 20.04.3 LTS Arch:x86_64

Which version of k3d

5.1.0

Which version of docker

20.10.11+azure-3
@arkadius arkadius added the bug Something isn't working label Jan 12, 2022
@iwilltry42 iwilltry42 added this to the v5.3.0 milestone Jan 12, 2022
@iwilltry42 iwilltry42 self-assigned this Jan 12, 2022
@iwilltry42
Copy link
Member

Hi @arkadius , thanks for opening this issue!
Having a quick look over your logs, it seems like your hitting an edge case here, where the first start of the tools node is still in progress (due to a slow image pull) and then the second start already kicks in not seeing, that there's already a container around for the tools node.
That's why the container ID is the same in Created container ... and in the error log saying that the name is already in use.

@arkadius
Copy link
Author

Hi, thank you for taking a look into logs. Is it possible to have some kind of lock to ensure that tools node is created only once?

@iwilltry42
Copy link
Member

I'll look into it as soon as I find the time 👍
As a workaround, you could try pulling the tools image upfront via docker pull rancher/k3d-tools:<k3d-version>

@arkadius
Copy link
Author

Thanks in advance. I'll give this workaroud a try. Thanks 👍

@spowers4u
Copy link

spowers4u commented May 14, 2022

i am getting the same error as well but this is different
############################################

 [spowers_sooraj@k3dk3smaster ~]$ sudo k3d cluster create
INFO[0000] Prep: Network                                
INFO[0000] Created network 'k3d-k3s-default'            
INFO[0000] Created image volume k3d-k3s-default-images  
INFO[0000] Starting new tools node...                   
ERRO[0000] Failed to run tools container for cluster 'k3s-default' 
INFO[0001] Creating node 'k3d-k3s-default-server-0'     
INFO[0001] Creating LoadBalancer 'k3d-k3s-default-serverlb' 
INFO[0001] Using the k3d-tools node to gather environment information 
INFO[0001] Starting new tools node...                   
ERRO[0001] Failed to run tools container for cluster 'k3s-default' 
ERRO[0001] failed to gather environment information used for cluster creation: failed to run k3d-tools node for cluster 'k3s-default': failed to create node 'k3d-k3s-default-tools': runtime failed to create node 'k3d-k3s-default-tools': failed to create container for node 'k3d-k3s-default-tools': docker failed to create container 'k3d-k3s-default-tools': Error response from daemon: invalid IP address in add-host: "host-gateway" 
ERRO[0001] Failed to create cluster >>> Rolling Back    
INFO[0001] Deleting cluster 'k3s-default'               
INFO[0001] Deleting cluster network 'k3d-k3s-default'   
INFO[0001] Deleting 2 attached volumes...               
WARN[0001] Failed to delete volume 'k3d-k3s-default-images' of cluster 'k3s-default': failed to find volume 'k3d-k3s-default-images': Error: No such volume: k3d-k3s-default-images -> Try to delete it manually 
FATA[0001] Cluster creation FAILED, all changes have been rolled back!

Anyone know this issue please help

@iwilltry42
Copy link
Member

@spowers4u which version of k3d are you using?

@spowers4u
Copy link

Hi @iwilltry42, I got it sorted out thanks. In fact the underlying docker version was not compatible. It requires to be atleast >=20.02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants