kubernetes: Building takes TOO much memory and fails
If I try to run hack/update-swagger-spec.sh in my vm with less than 2GB of RAM it fails with this error:
+++ [0725 01:58:03] Building apiserver
+++ [0725 01:58:10] Building go targets for linux/amd64:
cmd/kube-apiserver
go build github.com/GoogleCloudPlatform/kubernetes/pkg/ui/data/swagger: /usr/local/go/pkg/tool/linux_amd64/6g: signal: killed
!!! Error in /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:388
'CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${statics[@]:+${statics[@]}}"' exited with status 1
Call stack:
1: /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:388 kube::golang::build_binaries_for_platform(...)
2: /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:521 kube::golang::build_binaries(...)
3: /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/build-go.sh:26 main(...)
Exiting with status 1
!!! Error in /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:439
'kube::golang::build_binaries "$@"' exited with status 1
Call stack:
1: /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:439 kube::golang::build_binaries(...)
2: /home/vagrant/gopath/src/github.com/GoogleCloudPlatform/kubernetes/hack/build-go.sh:26 main(...)
Exiting with status 1
!!! Error in hack/update-swagger-spec.sh:40
'"${KUBE_ROOT}/hack/build-go.sh" cmd/kube-apiserver' exited with status 1
Call stack:
1: hack/update-swagger-spec.sh:40 main(...)
Exiting with status 1
+++ [0725 01:58:41] Clean up complete
I found that this file pkg/ui/data/swagger/datafile.go for some reason need a lot of memory to be builded. (it is a huge file btw with 48528 lines)
Is there anything we can do for that? I find it very difficult to run a VM in my laptop with more that 2GB which actually means that I can’t work…
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 2
- Comments: 47 (39 by maintainers)
I tried
build/make-clean.sh && build/run.sh makea couple of times with 5-8 GB or memory assigned to Docker for Mac, these are my results:In other words, it seems that Docker for Mac needs at least 8 GB to be able to somewhat consistently build Kubernetes currently.
make kubeletalso works - everything incmdis promoted to a top-level make rule 😃On Fri, Dec 7, 2018 at 10:08 AM Lubomir I. Ivanov notifications@github.com wrote:
you just saved me about 1000 keystrokes a week
having 16 GB of ram != exposing 16 GB to the docker daemon depending on your setup. if you’re on docker for mac / windows you’ll need to configure it to allow more ram for the VM
4.5G failed for me this morning, so tired of going by small increases, just threw up 8GB and it worked.
macOS High Sierra: 10.13.4 (17E202) Docker Community Edition 18.03.1-ce-mac65 (24312)
During my most recent experiments, I found that Kubernetes now needs 4.5GB+ to build on osx. https://github.com/kubernetes/kubernetes/pull/62219
I’m running into this problem as well, on a virtualbox ubuntu14.04 3GB RAM vm. It seems to be occuring on branch
release-1.2. When I switch torelease-1.1, the build works fine. Go1.5.3 installed and passingKUBERNETES_CONTRIB=mesosto make command. There is over 2GB free before the build.However, build does work fine on
release-1.2branch on bare-metal.Upping the VM RAM to 4GB (3+GB free on build) fixes issue (as noted in conversation above)
@sttts: I was able to get it to compile with
taskset 3 makewith 4GB, but I have had it run out of memory and fail a few times.What’s the recommended amount of memory needed to compile? I am still finding it to be a hit and miss with 4GB.