karmada-io / karmada

Open, Multi-Cloud, Multi-Cluster Kubernetes Orchestration
https://karmada.io
Apache License 2.0
4.51k stars 890 forks source link

Error running hack/local-up-karmada.sh #2405

Closed jxiang1995 closed 2 years ago

jxiang1995 commented 2 years ago

What happened: Error running hack/local-up-karmada.sh

How to reproduce it (as minimally and precisely as possible): run hack/local-up-karmada.sh.

Environment:

Console Record: azureuser@Karmada:~/downloads/karmada$ hack/local-up-karmada.sh Preparing: 'kind' existence check - passed Preparing: 'kubectl' existence check - passed Preparing kindClusterConfig in path: /tmp/tmp.MItcCAdRWj Creating cluster karmada-host and the log file is in /tmp/karmada/karmada-host.l og Creating cluster member1 and the log file is in /tmp/karmada/member1.log Creating cluster member2 and the log file is in /tmp/karmada/member2.log Creating cluster member3 and the log file is in /tmp/karmada/member3.log make: Entering directory '/home/azureuser/downloads/karmada' set -e;\ target=$(echo karmada-aggregated-apiserver);\ make $target GOOS=linux;\ VERSION=latest REGISTRY=swr.ap-southeast-1.myhuaweicloud.com/karmada BUILD_PLATF ORMS=linux/amd64 hack/docker.sh $target make[1]: Entering directory '/home/azureuser/downloads/karmada' LDFLAGS='-X github.com/karmada-io/karmada/pkg/version.gitVersion=v1.2.0-549-g79e 7820d -X github.com/karmada-io/karmada/pkg/version.gitCommit=79e7820dac159bbc9ac 7f52c00122945e37c3951 -X github.com/karmada-io/karmada/pkg/version.gitTreeState= dirty -X github.com/karmada-io/karmada/pkg/version.buildDate=2022-08-22T16:50:11 Z' BUILD_PLATFORMS=linux/amd64 hack/build.sh karmada-aggregated-apiserver !!! Building karmada-aggregated-apiserver for linux/amd64:

goroutine 1 [running]: debug/elf.(*Section).ReadAt(0xc0000b4320?, {0xc0002fac00?, 0x11f3230?, 0x34?}, 0 x40?)

:1 +0x26 archive/zip.readDirectoryEnd({0xbfa1c0, 0xc0000ff800}, 0x5b0) /usr/local/go/src/archive/zip/reader.go:526 +0xf5 archive/zip.(*Reader).init(0xc0002b7650, {0xbfa1c0?, 0xc0000ff800}, 0x5b0) /usr/local/go/src/archive/zip/reader.go:97 +0x5c archive/zip.NewReader({0xbfa1c0, 0xc0000ff800}, 0x5b0) /usr/local/go/src/archive/zip/reader.go:90 +0x5e github.com/daaku/go%2ezipexe.zipExeReaderElf({0xbfaf40?, 0xc0000140e0}, 0x11f3f3 0) /home/azureuser/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.0/zipexe.go:1 28 +0x8b github.com/daaku/go%2ezipexe.NewReader({0xbfaf40, 0xc0000140e0}, 0x0?) /home/azureuser/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.0/zipexe.go:4 8 +0x98 github.com/daaku/go%2ezipexe.OpenCloser({0xc00003e7e0?, 0xc0001c7be0?}) /home/azureuser/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.0/zipexe.go:3 0 +0x57 github.com/GeertJohan/go%2erice.init.0() /home/azureuser/go/pkg/mod/github.com/!geert!johan/go.rice@v1.0.0/append ed.go:41 +0x65 Failed to parse input: unexpected end of JSON input
RainbowMango commented 2 years ago

I've no clue about this yet but will try with Go1.19 on my side because we are using Go1.18 in our CI.

fly2F commented 2 years ago

I had the same problem.

➜  karmada git:(master) uname -a
Linux k8s-1 5.15.0-1016-gcp #21-Ubuntu SMP Fri Aug 5 12:17:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
➜  karmada git:(master) lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy
➜  karmada git:(master) go version
go version go1.19 linux/amd64
➜  karmada git:(master)

upgrading cfssl to 1.6.1 can solve the problem of cfssl installation go install github.com/cloudflare/cfssl/cmd/...@v1.6.1

RainbowMango commented 2 years ago

@jxiang1995 can you try to update cfssl version to v1.6.1 and try again? like:

diff --git a/hack/deploy-karmada.sh b/hack/deploy-karmada.sh
index f874d4ca..2026535f 100755
--- a/hack/deploy-karmada.sh
+++ b/hack/deploy-karmada.sh
@@ -16,7 +16,7 @@ KARMADA_APISERVER_SECURE_PORT=${KARMADA_APISERVER_SECURE_PORT:-5443}
 HOST_CLUSTER_NAME=${HOST_CLUSTER_NAME:-"karmada-host"}
 ROOT_CA_FILE=${CERT_DIR}/ca.crt
 ROOT_CA_KEY=${CERT_DIR}/ca.key
-CFSSL_VERSION="v1.5.0"
+CFSSL_VERSION="v1.6.1"
 LOAD_BALANCER=${LOAD_BALANCER:-false} # whether create a 'LoadBalancer' type service for karmada apiserver
 source "${REPO_ROOT}"/hack/util.sh

You might have to delete the old version of cfss:

$ command -v cfssl  # find old cfssl path
$ rm xxxx/xxx/cfssl    # remove it. The script will install a new one.
fly2F commented 2 years ago

@RainbowMango @jxiang1995 Due to the use of go.rice, cfssl segfaults when installed with Go 1.19. Need to install via go install github.com/cloudflare/cfssl/cmd/cfssl@master https://github.com/cloudflare/cfssl/issues/1233 https://github.com/cloudflare/cfssl/pull/1236

jxiang1995 commented 2 years ago

@liys87x @RainbowMango yes! It's working! Thank you guys!

Final solution: Go version: 1.19 Install cfssl via go install github.com/cloudflare/cfssl/cmd/cfssl@master cfssl version 1.6.2 - as today 8/23/2022

jxiang1995 commented 2 years ago

Note: I'm using Azure and GCP to host Karmada. I found I need to set open file limitation to a higher value to avoid "too many files opened" problem.

what I did: ulimit - n 65535 sudo sysctl fs.inotify.max_user_instances=1024

RainbowMango commented 2 years ago

Thanks @jxiang1995 .

This doc from Kind also addressed this issue: https://kind.sigs.k8s.io/docs/user/known-issues/#pod-errors-due-to-too-many-open-files