kubernetes: Kubelet build fails with local golang installation

What happened: I’ve been able to successfully install using yum, however I’m now trying to build the Kubelet using a local golang installation but I’ve hit the following error on the first build attempt with ‘make WHAT=cmd/kubelet’

# k8s.io/kubernetes/cmd/kubelet
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
collect2: error: ld returned 1 exit status
!!! [0302 16:55:20] Call tree:
!!! [0302 16:55:20]  1: /home/brad/go/src/k8s.io/kubernetes/hack/lib/golang.sh:714 kube::golang::build_some_binaries(...)
!!! [0302 16:55:20]  2: /home/brad/go/src/k8s.io/kubernetes/hack/lib/golang.sh:853 kube::golang::build_binaries_for_platform(...)
!!! [0302 16:55:20]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0302 16:55:20] Call tree:
!!! [0302 16:55:20]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0302 16:55:20] Call tree:
!!! [0302 16:55:20]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
make: *** [Makefile:93: all] Error 1

If I run the same command again however, the error disappears and I get a kubelet binary in the _output/bin directory.

However due to the error on first attempt, I’m not sure if the build is good which leads onto my follow up question. When does the kubelet.service file get created during the installation process, as I can’t run a ‘kubeadm join’ command to test the binary, and the kubelet binary itself fails when run on its own.

What you expected to happen: Successful Kubelet build.

How to reproduce it (as minimally and precisely as possible): Just running ‘make WHAT=cmd/kubelet’ on the source detached at the v1.17.3 tag.

Anything else we need to know?: Originally installed the kubectl, kubeadm, and kubelet components through yum which worked successfully, and then removed to try build from source.

Would appreciate any guidance for installing with a local installation on the whole. Have spent a lot of time digging around the source to understand the process and what the yum installer does differently to create things like the service file.

Environment:

  • Kubernetes version (use kubectl version): Haven’t built/installed kubectl binary, but attempting from v1.17.3 tag
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release): CentOS Linux 7 (Core)
  • Kernel (e.g. uname -a):
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others: go version go1.13.6 linux/amd64

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (16 by maintainers)

Most upvoted comments

I’ll close it off since it doesn’t seem to be Kubernetes related, but will update with further details if I find any later.