rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.82k stars 272 forks source link

`kind` cluster creation fails with WSL2 #5604

Open AnhQuanTrl opened 11 months ago

AnhQuanTrl commented 11 months ago

Actual Behavior

I tried to create a kind cluster inside WSL 2 with Rancher Desktop and get the following error:

Creating cluster "tkb" ...
 βœ“ Ensuring node image (kindest/node:v1.28.0) πŸ–Ό
 βœ“ Preparing nodes πŸ“¦ πŸ“¦ πŸ“¦ πŸ“¦
 βœ— Writing configuration πŸ“œ
Deleted nodes: ["tkb-control-plane" "tkb-worker2" "tkb-worker" "tkb-worker3"]
ERROR: failed to create cluster: failed to generate kubeadm config content: failed to get kubernetes version from node: file should only be one line, got 0 lines

Steps to Reproduce

  1. Install Rancher Desktop and WSL2
  2. Enable WSL integration in Rancher Desktop.
  3. Inside Ubuntu WSL2, install kind.
  4. Run kind create cluster --config cluster-config.yml Here is my cluster-config.yml:
    kind: Cluster
    apiVersion: kind.x-k8s.io/v1alpha4
    name: tkb
    networking:
    ipFamily: dual
    nodes:
    - role: control-plane
    image: kindest/node:v1.28.0
    extraPortMappings:
    - containerPort: 30001
    hostPort: 8083
    protocol: TCP
    - role: worker
    image: kindest/node:v1.28.0
    - role: worker
    image: kindest/node:v1.28.0
    - role: worker
    image: kindest/node:v1.28.0

Result

I got this error: ERROR: failed to create cluster: failed to generate kubeadm config content: failed to get kubernetes version from node: file should only be one line, got 0 lines

Expected Behavior

kind should be able to create a cluster.

Additional Information

I took a look at kind repository and found a similar issue: https://github.com/kubernetes-sigs/kind/issues/3010. It seems the kind folks redirected the original poster here. I had the exact problem so figures I should post it here first.

Rancher Desktop Version

1.10.0

Rancher Desktop K8s Version

1.28.1

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Window 11 Pro 22H2. WSL 2 Ubuntu 22.04.2

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

gunamata commented 11 months ago

I could reproduce the issue on my Windows 10 with the steps given in the issue description. Just running kind create cluster produces the same error as well.

jandubois commented 11 months ago

This is a duplicate of #5092.

jandubois commented 11 months ago

Sorry, I was mistaken, #5092 is about macOS, where kind fails due to a different reason.