sealer icon indicating copy to clipboard operation
sealer copied to clipboard

`index out of range [0] with length 0` Cluster creation failure

Open huhouhua opened this issue 2 years ago • 1 comments

What happen?

run the sealer run -f Clusterfile.yaml command

2023-11-14 15:09:26 [INFO] [installer.go:233] start to create new cluster with image: 172.17.162.231/support/kube:v1.22.15-docker.base.9c7b811

2023-11-14 15:09:26 [INFO] [installer.go:456] The cri is docker, cluster runtime type is kubernetes


2023-11-14 15:09:26 [INFO] [clusterfile.go:198] succeeded in saving clusterfile

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/sealerio/sealer/pkg/cluster-runtime.(*Installer).Install(0xc0007e9800)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/pkg/cluster-runtime/installer.go:139 +0xa6f
github.com/sealerio/sealer/cmd/sealer/cmd/cluster.KubeInstaller.Install({{0x36445c8, 0xc000902000}, {0x367b760, 0xc00044a840}, {0x36783c0, 0xc000357fe0}, 0xc00044a2c0}, {0xc000315040, 0x38}, {{0x3222dac, ...}, ...})
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/cluster/installer.go:314 +0xa85
github.com/sealerio/sealer/cmd/sealer/cmd/cluster.runWithClusterfile({0x7fff907d185b, 0x0}, 0xc0003a0620)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/cluster/run.go:182 +0x869
github.com/sealerio/sealer/cmd/sealer/cmd/cluster.NewRunCmd.func1(0xc000868a00, {0xc0007136a0, 0x0, 0x2})
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/cluster/run.go:79 +0x114
github.com/spf13/cobra.(*Command).execute(0xc000868a00, {0xc000713680, 0x2, 0x2})
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/vendor/github.com/spf13/cobra/command.go:872 +0x624
github.com/spf13/cobra.(*Command).ExecuteC(0x49c3900)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/vendor/github.com/spf13/cobra/command.go:990 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/vendor/github.com/spf13/cobra/command.go:918
github.com/sealerio/sealer/cmd/sealer/cmd.Execute()
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/root.go:74 +0x25
main.main()
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/main.go:26 +0x29

This is the Clusterfile.yaml configuration information for the file. image

Relevant log output?

2023-11-14 15:09:26 [INFO] [installer.go:233] start to create new cluster with image: 172.17.162.231/support/kube:v1.22.15-docker.base.9c7b811

2023-11-14 15:09:26 [INFO] [installer.go:456] The cri is docker, cluster runtime type is kubernetes


2023-11-14 15:09:26 [INFO] [clusterfile.go:198] succeeded in saving clusterfile

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/sealerio/sealer/pkg/cluster-runtime.(*Installer).Install(0xc0007e9800)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/pkg/cluster-runtime/installer.go:139 +0xa6f
github.com/sealerio/sealer/cmd/sealer/cmd/cluster.KubeInstaller.Install({{0x36445c8, 0xc000902000}, {0x367b760, 0xc00044a840}, {0x36783c0, 0xc000357fe0}, 0xc00044a2c0}, {0xc000315040, 0x38}, {{0x3222dac, ...}, ...})
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/cluster/installer.go:314 +0xa85
github.com/sealerio/sealer/cmd/sealer/cmd/cluster.runWithClusterfile({0x7fff907d185b, 0x0}, 0xc0003a0620)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/cluster/run.go:182 +0x869
github.com/sealerio/sealer/cmd/sealer/cmd/cluster.NewRunCmd.func1(0xc000868a00, {0xc0007136a0, 0x0, 0x2})
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/cluster/run.go:79 +0x114
github.com/spf13/cobra.(*Command).execute(0xc000868a00, {0xc000713680, 0x2, 0x2})
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/vendor/github.com/spf13/cobra/command.go:872 +0x624
github.com/spf13/cobra.(*Command).ExecuteC(0x49c3900)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/vendor/github.com/spf13/cobra/command.go:990 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/vendor/github.com/spf13/cobra/command.go:918
github.com/sealerio/sealer/cmd/sealer/cmd.Execute()
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/cmd/root.go:74 +0x25
main.main()
	/home/runner/work/sealer/sealer/src/github.com/sealerio/sealer/cmd/sealer/main.go:26 +0x29

![image](https://github.com/sealerio/sealer/assets/40319281/bb4f418a-c36f-40d8-8e8f-f666e365cf45)

What you expected to happen?

Cluster Created successfully

How to reproduce it (as minimally and precisely as possible)?

No response

Anything else we need to know?

No response

What is the version of Sealer you using?

{"gitVersion":"v0.11.0","gitCommit":"f07e804","buildDate":"2023-07-25 02:51:08","goVersion":"go1.17.13","compiler":"gc","platform":"linux/amd64"}

What is your OS environment?

CentOS Linux 7 (Core)

What is the Kernel version?

Linux master-01 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Other environment you want to tell us?

  • Cloud provider or hardware configuration:
  • Install tools:
  • Others: image

huhouhua avatar Nov 14 '23 07:11 huhouhua

I solved the problem, the master wrote the wrong characters, but this error message can be more friendly?

huhouhua avatar Nov 14 '23 08:11 huhouhua