kontena / pharos-cluster

Pharos - The Kubernetes Distribution
https://k8spharos.dev/
Apache License 2.0
311 stars 43 forks source link

pharos-cluster version 1.3.0 fails with Centos/7 #585

Closed jeremy-moore closed 6 years ago

jeremy-moore commented 6 years ago

Running example Vagrant Centos/7 gives the following (same as actual servers):

pharos-cluster up
==> KONTENA PHAROS v1.3.0 (Kubernetes v1.11.1)
==> Reading instructions ...
==> Sharpening tools ...
==> Gather host facts @ 192.168.110.100 192.168.110.101 192.168.110.102
    [192.168.110.102] Checking sudo access ...
    [192.168.110.101] Checking sudo access ...
    [192.168.110.100] Checking sudo access ...
    [192.168.110.100] Gathering host facts ...
    [192.168.110.101] Gathering host facts ...
    [192.168.110.102] Gathering host facts ...
    [host-00] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-00] retrying after 1 seconds ...
    [host-01] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-01] retrying after 1 seconds ...
    [host-02] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-02] retrying after 1 seconds ...
    [192.168.110.100] Checking sudo access ...
    [192.168.110.100] Gathering host facts ...
    [192.168.110.101] Checking sudo access ...
    [192.168.110.101] Gathering host facts ...
    [192.168.110.102] Checking sudo access ...
    [192.168.110.102] Gathering host facts ...
    [host-00] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-00] retrying after 2 seconds ...
    [host-01] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-01] retrying after 2 seconds ...
    [host-02] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-02] retrying after 2 seconds ...
    [192.168.110.100] Checking sudo access ...
    [192.168.110.100] Gathering host facts ...
    [192.168.110.101] Checking sudo access ...
    [192.168.110.101] Gathering host facts ...
    [192.168.110.102] Checking sudo access ...
    [192.168.110.102] Gathering host facts ...
    [host-00] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
    [host-00] retrying after 4 seconds ...
    [host-01] got error (Pharos::SSH::RemoteCommand::ExecError): SSH exec failed with code 127: ip route
bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
/etc/profile.d/lang.sh: line 32: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8)
bash: ip: command not found
...
jeremy-moore commented 6 years ago

Works with:

config.vm.box = "ubuntu/bionic64"
jnummelin commented 6 years ago

Seems we've made the assumption that Centos has 'ip' binary always available. Pharos CentOS provisioner should ensure that it's available. So definitely a bug.

jeremy-moore commented 6 years ago

Seem that ip is there:

$ vagrant ssh host-00
[vagrant@host-00 ~]$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:c9:c7:04 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic eth0
       valid_lft 86361sec preferred_lft 86361sec
    inet6 fe80::5054:ff:fec9:c704/64 scope link 
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:09:3f:f1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.110.100/24 brd 192.168.110.255 scope global noprefixroute eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe09:3ff1/64 scope link 
       valid_lft forever preferred_lft forever
[vagrant@host-00 ~]$ 
jakolehm commented 6 years ago

I have reproduced this with Vagrant. Somehow vagrant user does not have /usr/sbin in $PATH when executed through pharos. Fix would be execute sudo ip route which has the proper path set.