k3d-io / k3d

Little helper to run CNCF's k3s in Docker
https://k3d.io/
MIT License
5.48k stars 462 forks source link

[BUG] add node "Host Gateway IP is missing! " use remote cluster #1456

Open NatureLR opened 5 months ago

NatureLR commented 5 months ago

What did you do

Screenshots or terminal output

[root@10-60-251-136 ~]# k3d node create demo -c https://10.60.41.217:43695 --role agent --token vifcTsPQvknhapMjMQIW --verbose
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock
DEBU[0000] Runtime Info:
&{Name:docker Endpoint:/var/run/docker.sock Version:26.1.3 OSType:linux OS:CentOS Linux 8 Arch:x86_64 CgroupVersion:1 CgroupDriver:cgroupfs Filesystem:xfs InfoName:10-60-251-136}
INFO[0000] Adding 1 node(s) to the remote cluster 'https://10.60.41.217:43695'...
DEBU[0000] DOCKER_SOCK=/var/run/docker.sock
DEBU[0000] [autofix cgroupsv2] cgroupVersion: 1
DEBU[0000] Created container k3d-demo-0 (ID: ba4608d9b51fa19a17d863b93231be9c59599b56b2d0d1aa61e33548d14bf9ca)
DEBU[0000] >>> enabling dns magic
FATA[0000] failed to add 1 node(s) to the remote cluster 'https://10.60.41.217:43695': failed to add one or more nodes: failed to run node 'k3d-demo-0': failed to start node 'k3d-demo-0': failed to enable k3d fixes: Cannot enable DNS fix, as Host Gateway IP is missing!

Which OS & Architecture

[root@10-60-251-136 ~]# k3d runtime-info
arch: x86_64
cgroupdriver: cgroupfs
cgroupversion: "1"
endpoint: /var/run/docker.sock
filesystem: xfs
infoname: 10-60-251-136
name: docker
os: CentOS Linux 8
ostype: linux
version: 26.1.3

Which version of k3d

[root@10-60-251-136 ~]# k3d version
k3d version v5.6.3
k3s version v1.28.8-k3s1 (default)

Which version of docker

[root@10-60-251-136 ~]# docker version
Client: Docker Engine - Community
 Version:           26.1.3
 API version:       1.45
 Go version:        go1.21.10
 Git commit:        b72abbb
 Built:             Thu May 16 08:34:39 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.1.3
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.10
  Git commit:       8e96db1
  Built:            Thu May 16 08:33:34 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.32
  GitCommit:        8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
[root@10-60-251-136 ~]# docker info
Client: Docker Engine - Community
 Version:    26.1.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.14.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.27.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 3
 Server Version: 26.1.3
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  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 splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 8b3b7ca2e5ce38e8f31a34f35b2b68ceb8470d89
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 4.18.0-305.3.1.el8.x86_64
 Operating System: CentOS Linux 8
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.649GiB
 Name: 10-60-251-136
 ID: 99f9ddb1-9ddc-475f-bad2-be81d5a57d1c
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
HaVonTe1 commented 4 months ago

I have the same issue with 5.7.2 ➜ ~ k3d --version k3d version v5.7.2 k3s version v1.29.6-k3s2 (default)

➜ ~ k3d node create agent-node --role agent --token $K3S_TOKEN --cluster https://192.168.178.105:6443 --network k3d-network --trace DEBU[0000] DOCKER_SOCK=/var/run/docker.sock DEBU[0000] Runtime Info: &{Name:docker Endpoint:/var/run/docker.sock Version:27.0.3 OSType:linux OS:Debian GNU/Linux 12 (bookworm) Arch:x86_64 CgroupVersion:2 CgroupDriver:systemd Filesystem:extfs InfoName:minipc} INFO[0000] Adding 1 node(s) to the remote cluster 'https://192.168.178.105:6443'... TRAC[0000] Creating node from spec &{Name:k3d-agent-node-0 Role:agent Image:docker.io/rancher/k3s:v1.29.6-k3s2 Volumes:[] Env:[K3S_URL=https://192.168.178.105:6443 K3S_TOKEN=mysecrettoken] Cmd:[] Args:[] Files:[] Ports:map[] Restart:true Created: HostPidMode:false RuntimeLabels:map[app:k3d k3d.cluster:https://192.168.178.105:6443 k3d.cluster.external:true k3d.cluster.token:mysecrettoken k3d.cluster.url:https://192.168.178.105:6443 k3d.role:agent k3d.version:v5.7.2] RuntimeUlimits:[] K3sNodeLabels:map[] Networks:[k3d-network] ExtraHosts:[] ServerOpts:{IsInit:false KubeAPI:} AgentOpts:{} GPURequest: Memory: State:{Running:false Status: Started:} IP:{IP:invalid IP Static:false} HookActions:[] K3dEntrypoint:false} DEBU[0000] DOCKER_SOCK=/var/run/docker.sock DEBU[0000] [autofix cgroupsv2] cgroupVersion: 2 TRAC[0000] Creating docker container with translated config &{ContainerConfig:{Hostname:k3d-agent-node-0 Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:false OpenStdin:false StdinOnce:false Env:[K3S_URL=https://192.168.178.105:6443 K3S_TOKEN=mysecrettoken K3S_KUBECONFIG_OUTPUT=/output/kubeconfig.yaml] Cmd:[agent] Healthcheck: ArgsEscaped:false Image:docker.io/rancher/k3s:v1.29.6-k3s2 Volumes:map[] WorkingDir: Entrypoint:[/bin/k3d-entrypoint.sh] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[app:k3d k3d.cluster:https://192.168.178.105:6443 k3d.cluster.external:true k3d.cluster.token:mysecrettoken k3d.cluster.url:https://192.168.178.105:6443 k3d.role:agent k3d.version:v5.7.2] StopSignal: StopTimeout: Shell:[]} HostConfig:{Binds:[] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:bridge PortBindings:map[] RestartPolicy:{Name:unless-stopped MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] ConsoleSize:[0 0] Annotations:map[] 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:host ShmSize:0 Sysctls:map[] Runtime: 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: OomKillDisable: PidsLimit: Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[] MaskedPaths:[] ReadonlyPaths:[] Init:0xc0002e096f} NetworkingConfig:{EndpointsConfig:map[k3d-network:0xc0001808c0]}} DEBU[0000] Created container k3d-agent-node-0 (ID: 2bffb9bd34d963678ff4495366b3d32993ca7f6d6ff15941d6fad0a54b2fb967) DEBU[0000] >>> enabling dns magic FATA[0000] failed to add 1 node(s) to the remote cluster 'https://192.168.178.105:6443': failed to add one or more nodes: failed to run node 'k3d-agent-node-0': failed to start node 'k3d-agent-node-0': failed to enable k3d fixes: Cannot enable DNS fix, as Host Gateway IP is missing!