-
Notifications
You must be signed in to change notification settings - Fork 41
Conversation
Trying this branch:
Solved with: diff --git a/Vagrantfile b/Vagrantfile
index 7bb225d..0a52228 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -25,6 +25,10 @@ Vagrant.configure("2") do |config|
vb.customize ["modifyvm", :id, "--cpus", "1"]
end
+ # Prevent TTY Errors (copied from laravel/homestead: "homestead.rb" file)... By default this is "bash -l".
+ # https://stackoverflow.com/questions/40815349/vagrant-ubuntu-box-inline-scripts-emitting-mesg-ttyname-failed-inappropriate-io/42397127#42397127
+ config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
+
config.vm.provision "shell", inline: <<HERE
profile=/home/ubuntu/.bash_profile
if [ ! -e $profile ]; then touch $profile; fi After that, the VM starts fine for me. |
Vagrantfile
Outdated
# config.vbguest.auto_update = true | ||
|
||
config.vm.synced_folder ".", "/vagrant", disabled: true | ||
config.vm.synced_folder ".", "/go/src/github.com/kinvolk/kubeadm-nspawn", create: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not build in the VM:
ubuntu@ubuntu-zesty:/go/src/github.com/kinvolk/kubeadm-nspawn$ make
go build -o cni-noop ./cmd/cni-noop
go build -o cnispawn ./cmd/cnispawn
go build -o nspawn-runc ./cmd/nspawn-runc
go build -o kubeadm-nspawn ./cmd/kubeadm-nspawn
pkg/nspawntool/node.go:26:2: cannot find package "k8s.io/kubernetes/pkg/util/procfs" in any of:
/go/src/github.com/kinvolk/kubeadm-nspawn/vendor/k8s.io/kubernetes/pkg/util/procfs (vendor tree)
/usr/lib/go-1.7/src/k8s.io/kubernetes/pkg/util/procfs (from $GOROOT)
/go/src/k8s.io/kubernetes/pkg/util/procfs (from $GOPATH)
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 1
Maybe add more synced_folder for the dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or vendor it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like glide
didn't run... Maybe still something with the Makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not tried make vendor
before.
When trying:
$ make vendor
package github.com/Masterminds/glide: mkdir /go/src/github.com/Masterminds/: permission denied
Makefile:15: recipe for target 'glide' failed
make: *** [glide] Error 1
What about preparing the GOPATH in /home/ubuntu/go
instead of /go
, and then make sure it belongs to the correct user?
The user "ubuntu" should be added in the group "docker". Otherwise, the build of Kubernetes in the vagrant VM will fail:
|
I have tried with passing the full GOPATH directory to the vagrant VM: diff --git a/Vagrantfile b/Vagrantfile
index 7bb225d..0da8b65 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -2,7 +2,6 @@
# vi: set ft=ruby :
ENV["TERM"] = "xterm-256color"
-ENV["GOPATH"] = "/go"
ENV["LC_ALL"] = "en_US.UTF-8"
Vagrant.configure("2") do |config|
@@ -13,8 +12,7 @@ Vagrant.configure("2") do |config|
# config.vbguest.auto_update = true
- config.vm.synced_folder ".", "/vagrant", disabled: true
- config.vm.synced_folder ".", "/go/src/github.com/kinvolk/kubeadm-nspawn", create: true
+ config.vm.synced_folder "#{ENV['GOPATH']}", "/go", create: true
# config.vm.provider :virtualbox do |vbox|
# vbox.check_guest_additions = false
# vbox.functional_vboxsf = false |
Vagrantfile
Outdated
# config.vm.box = "fedora/25-cloud-base" | ||
# config.vm.provision "shell", inline: "dnf install -y go git docker" | ||
config.vm.box = "ubuntu/zesty64" | ||
config.vm.provision "shell", inline: "DEBIAN_FRONTEND=noninteractive apt-get install -y golang git docker.io systemd-container tmux" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could add one more line after installing docker:
config.vm.provision "shell", inline: "usermod -aG docker ubuntu"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we maybe use the non-docker build?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know there was a non-docker build. But that line with usermod
works for me ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the line.
Vagrantfile
Outdated
# end | ||
|
||
config.vm.provider :virtualbox do |vb| | ||
vb.customize ["modifyvm", :id, "--memory", "1024"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently, not enough to build Kubernetes:
Env for linux/amd64: GOOS=linux GOARCH=amd64 GOROOT=/usr/local/go_k8s_patched CGO_ENABLED= CC=
go build k8s.io/kubernetes/cmd/kubelet/app: /usr/local/go_k8s_patched/pkg/tool/linux_amd64/compile: signal: killed
# k8s.io/kubernetes/cmd/kube-controller-manager/app
fatal error: runtime: out of memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying with 4096. It takes some time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still fails with the same error with 4094.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the error was:
Env for linux/amd64: GOOS=linux GOARCH=amd64 GOROOT=/usr/local/go_k8s_patched CGO_ENABLED= CC=
# k8s.io/kubernetes/cmd/genman
/usr/local/go_k8s_patched/pkg/tool/linux_amd64/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory
!!! [0614 16:33:34] Call tree:
!!! [0614 16:33:34] 1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:715 kube::golang::build_binaries_for_platform(...)
!!! [0614 16:33:34] 2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! Error in /go/src/k8s.io/kubernetes/hack/lib/golang.sh:530
Error in /go/src/k8s.io/kubernetes/hack/lib/golang.sh:530. '((i<4-1))' exited with status 2
Call stack:
1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:530 kube::golang::build_binaries_for_platform(...)
2: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:715 kube::golang::build_binaries(...)
3: hack/make-rules/build.sh:27 main(...)
Exiting with status 1
!!! [0614 16:33:34] Call tree:
!!! [0614 16:33:34] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! Error in /go/src/k8s.io/kubernetes/hack/lib/golang.sh:711
Error in /go/src/k8s.io/kubernetes/hack/lib/golang.sh:711. '((i<3-1))' exited with status 1
Call stack:
1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:711 kube::golang::build_binaries(...)
2: hack/make-rules/build.sh:27 main(...)
Exiting with status 1
!!! [0614 16:33:34] Call tree:
!!! [0614 16:33:34] 1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! Error in /go/src/k8s.io/kubernetes/hack/lib/golang.sh:620
Error in /go/src/k8s.io/kubernetes/hack/lib/golang.sh:620. '((i<3-1))' exited with status 1
Call stack:
1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:620 kube::golang::build_binaries(...)
2: hack/make-rules/build.sh:27 main(...)
Exiting with status 1
Makefile:89: recipe for target 'all' failed
make: *** [all] Error 1
!!! [0614 16:33:35] Call tree:
!!! [0614 16:33:35] 1: build/../build/common.sh:513 kube::build::run_build_command_ex(...)
!!! [0614 16:33:35] 2: build/run.sh:30 kube::build::run_build_command(...)
!!! Error in build/../build/common.sh:578
Error in build/../build/common.sh:578. '((i<4-1))' exited with status 2
Call stack:
1: build/../build/common.sh:578 kube::build::run_build_command_ex(...)
2: build/../build/common.sh:513 kube::build::run_build_command(...)
3: build/run.sh:30 main(...)
Exiting with status 1
...
With the fork/exec error, I wonder if it is about pids limit in the pids cgroup controller. But it does not seem to be the case:
$ sudo cat /sys/fs/cgroup/pids//docker/d23fd83a4c92fa1854f111cb77d39c70496589d0d8c3a115bba292b9bacffc57/pids.max
max
any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what to do here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know either... I would use 4096 and investigate if the error ever happens again.
2544d00
to
b3562f7
Compare
b3562f7
to
db11d75
Compare
Vagrantfile
Outdated
ENV["LC_ALL"] = "en_US.UTF-8" | ||
|
||
Vagrant.configure("2") do |config| | ||
# config.vm.box = "fedora/25-cloud-base" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't use fedora25 because machinectl
doesn't work with systemd <=232
systemd/systemd#3996
AFAICT most of the comments for the PR are already out-of-date, because the whole /cc @robertgzr @alban |
@dongsupark If I remember correctly the memory issue came up when building kubernetes (which is what we did originally) I am not sure how to do that, if we need to be able to do this in the vagrant box? |
@robertgzr Yeah, I already have done several complete k8s rebuilds in the Vagrant box, but haven't seen such a failure. Maybe more tight memory constraints are necessary for reproducing it. |
Update the README on how to use it