Giter Site home page Giter Site logo

fleetctl ssh fails with Vagrant about fleet HOT 19 CLOSED

coreos avatar coreos commented on August 19, 2024
fleetctl ssh fails with Vagrant

from fleet.

Comments (19)

bcwaldon avatar bcwaldon commented on August 19, 2024

...aaaaand I screwed up. The docs for the environment variable stuff landed before the actual feature :) Use --tunnel for now.

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024

Well everything else works. I can list-units, list-machines, start, stop, etc. with any problem.

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024

And passing --tunnel also fails, but with a slightly different error...

$ fleetctl --tunnel 127.0.0.1:2222 ssh --unit hello.service
2014/02/20 20:52:43 Unable to establish SSH connection: ssh: unable to open direct tcpip connection: open failed

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

Is Vagrant binding etcd to your laptop's localhost port 4001?

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

And are you confident Vagrant is using port 2222 for that SSH tunnel? Maybe share the output of

vagrant ssh-config

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024

Is Vagrant binding etcd to your laptop's localhost port 4001?

yup

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024
$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User core
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/joelmoss/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

list-units works...

$ fleetctl list-units                                      
UNIT        LOAD    ACTIVE  SUB DESC    MACHINE
hello.service   loaded  active  running -   fb3d1c42...

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

For the fleetctl list-units (and other working commands), fleetctl is just talking to etcd bound to localhost port 4001.

For the commands that do not work (status, journal, etc), fleetctl wants to SSH to the machine hosting a given unit. Your machine is not publishing an IP address, so it is probably trying to ssh to localhost port 22, which is refusing connections.

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

I'm going to go poke at this on my box real quick.

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

@joelmoss What's the output of fleetctl list-machines?

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024
$ fleetctl list-machines                   
MACHINE     IP  METADATA
fb3d1c42... -   -

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

One more... cat /etc/os-release

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

So the reason your machine isn't publishing an IP is because fleet just looks for the first ipv4 address on the eth0 interface, which vagrant does not have.

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024
core@localhost ~ $ cat /etc/os-release
NAME=CoreOS
ID=coreos
VERSION=231.0.0
VERSION_ID=231.0.0
BUILD_ID=
PRETTY_NAME="CoreOS 231.0.0 (Official Build) dev-channel amd64-generic test"
ANSI_COLOR="1;32"
HOME_URL="http://www.coreos.com/"

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

Thank you, sir. I'll get back to you in a minute.

from fleet.

joelmoss avatar joelmoss commented on August 19, 2024

Using my Vagrant private IP also fails...

$ fleetctl --tunnel 172.12.8.150 ssh --unit hello.service 
2014/02/20 21:03:55 Unable to establish SSH connection: ssh: unable to open direct tcpip connection: open failed

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

@joelmoss #152 will enable us to fix this problem on vagrant

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

We can use that code with fleet.conf:

public_interface="lo"

...but we really need the stock coreos vagrant box to ship with it

from fleet.

bcwaldon avatar bcwaldon commented on August 19, 2024

I actually have a better solution in #155. It uses netlink to determine which local interface is likely to have a routable IP bound to it. When using it with Vagrant, you end up with the IP on the private vagrant network, but that's ok:

% fleetctl --tunnel 127.0.0.1:2222 list-units
UNIT        LOAD    ACTIVE  SUB DESC    MACHINE
hello.service   loaded  active  running -   d66f8269.../10.0.2.15
% fleetctl --tunnel 127.0.0.1:2222 status hello.service
hello.service - Hello World
   Loaded: loaded (/run/systemd/system/hello.service; enabled-runtime)
   Active: active (running) since Thu 2014-02-20 14:06:43 UTC; 1min 18s ago
 Main PID: 4092 (bash)
   CGroup: /system.slice/hello.service
           ├─4092 /bin/bash -c while true; do echo "Hello, world"; sleep 1; done
           └─4198 sleep 1

Feb 20 14:07:52 localhost bash[4092]: Hello, world
Feb 20 14:07:53 localhost bash[4092]: Hello, world
Feb 20 14:07:54 localhost bash[4092]: Hello, world
Feb 20 14:07:55 localhost bash[4092]: Hello, world
Feb 20 14:07:56 localhost bash[4092]: Hello, world
Feb 20 14:07:57 localhost bash[4092]: Hello, world
Feb 20 14:07:58 localhost bash[4092]: Hello, world
Feb 20 14:07:59 localhost bash[4092]: Hello, world
Feb 20 14:08:00 localhost bash[4092]: Hello, world
Feb 20 14:08:01 localhost bash[4092]: Hello, world

from fleet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.