User Tools

Site Tools


cloud:coreos:fleet

This is an old revision of the document!


fleet is deprecated by coreos, is replaced by kubernetes.

fleet, a simple distributed service manager.

Get started

core@core-03 ~ $ fleetctl
NAME:
	fleetctl - fleetctl is a command-line interface to fleet, the cluster-wide CoreOS init system.
 
USAGE: 
	fleetctl [global options] <command> [command options] [arguments...]
 
VERSION:
	0.11.8
 
COMMANDS:
	cat		Output the contents of a submitted unit
	destroy		Destroy one or more units in the cluster
	fd-forward	Proxy stdin and stdout to a unix domain socket
	help		Show a list of commands or help for one command
	journal		Print the journal of a unit in the cluster to stdout
	list-machines	Enumerate the current hosts in the cluster
	list-unit-files	List the units that exist in the cluster.
	list-units	List the current state of units in the cluster
	load		Schedule one or more units in the cluster, first submitting them if necessary.
	ssh		Open interactive shell on a machine in the cluster
	start		Instruct systemd to start one or more units in the cluster, first submitting and loading if necessary.
	status		Output the status of one or more units in the cluster
	stop		Instruct systemd to stop one or more units in the cluster.
	submit		Upload one or more units to the cluster without starting them
	unload		Unschedule one or more units in the cluster.
	verify		DEPRECATED - No longer works
	version		Print the version and exit
 
GLOBAL OPTIONS:
	--ca-file=					Location of TLS CA file used to secure communication with the fleet API or etcd
	--cert-file=					Location of TLS cert file used to secure communication with the fleet API or etcd
	--debug=false					Print out more debug information to stderr
	--driver=API					Adapter used to execute fleetctl commands. Options include "API" and "etcd".
	--endpoint=unix:///var/run/fleet.sock		Location of the fleet API if --driver=API. Alternatively, if --driver=etcd, location of the etcd API.
	--etcd-key-prefix=/_coreos.com/fleet/		Keyspace for fleet data in etcd (development use only!)
	-h=false					Print usage information and exit
	--help=false					Print usage information and exit
	--key-file=					Location of TLS key file used to secure communication with the fleet API or etcd
	--known-hosts-file=~/.fleetctl/known_hosts	File used to store remote machine fingerprints. Ignored if strict host key checking is disabled.
	--request-timeout=3				Amount of time in seconds to allow a single request before considering it failed.
	--ssh-timeout=10				Amount of time in seconds to allow for SSH connection initialization before failing.
	--ssh-username=core				Username to use when connecting to CoreOS instance.
	--strict-host-key-checking=true			Verify host keys presented by remote machines before initiating SSH connections.
	--tunnel=					Establish an SSH tunnel through the provided address for communication with fleet and etcd.
	--version=false					Print the version and exit
 
 
 
core@core-03 ~ $ fleetctl list-machines
MACHINE		IP		METADATA
0d9ba9f8...	172.17.8.102	-
50018d3c...	172.17.8.103	-
68d60645...	172.17.8.101	-
 
core@core-03 ~ $ cat hello.service 
[Unit]
Description=My Service
After=docker.service
 
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill hello
ExecStartPre=-/usr/bin/docker rm hello
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run --name hello busybox /bin/sh -c "trap 'exit 0' INT TERM; while true; do echo Hello World; sleep 1; done"
ExecStop=/usr/bin/docker stop hello
 
core@core-03 ~ $ fleetctl load hello.service 
Unit hello.service inactive
Unit hello.service loaded on 0d9ba9f8.../172.17.8.102
core@core-03 ~ $ 
core@core-03 ~ $ 
core@core-03 ~ $ fleetctl cat hello.service
[Unit]
Description=My Service
After=docker.service
 
[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill hello
ExecStartPre=-/usr/bin/docker rm hello
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run --name hello busybox /bin/sh -c "trap 'exit 0' INT TERM; while true; do echo Hello World; sleep 1; done"
ExecStop=/usr/bin/docker stop hello
 
core@core-03 ~ $ fleetctl start hello.service
Unit hello.service launched on 0d9ba9f8.../172.17.8.102
core@core-03 ~ $ 
core@core-03 ~ $ fleetctl status hello.service
● hello.service - My Service
   Loaded: loaded (/run/fleet/units/hello.service; linked-runtime; vendor preset: disabled)
   Active: active (running) since Mon 2017-02-13 17:56:47 UTC; 6s ago
  Process: 6528 ExecStartPre=/usr/bin/docker pull busybox (code=exited, status=0/SUCCESS)
  Process: 6521 ExecStartPre=/usr/bin/docker rm hello (code=exited, status=0/SUCCESS)
  Process: 6505 ExecStartPre=/usr/bin/docker kill hello (code=exited, status=1/FAILURE)
 Main PID: 6535 (docker)
    Tasks: 7
   Memory: 6.3M
      CPU: 53ms
   CGroup: /system.slice/hello.service
           └─6535 /usr/bin/docker run --name hello busybox /bin/sh -c trap 'exit 0' INT TERM; while true; do echo Hello World; sleep 1; done
 
Feb 13 17:56:47 core-02 docker[6528]: latest: Pulling from library/busybox
Feb 13 17:56:47 core-02 docker[6528]: Digest: sha256:817a12c32a39bbe394944ba49de563e085f1d3c5266eb8e9723256bc4448680e
Feb 13 17:56:47 core-02 docker[6528]: Status: Image is up to date for busybox:latest
Feb 13 17:56:47 core-02 systemd[1]: Started My Service.
Feb 13 17:56:47 core-02 docker[6535]: Hello World
Feb 13 17:56:48 core-02 docker[6535]: Hello World
Feb 13 17:56:49 core-02 docker[6535]: Hello World
Feb 13 17:56:50 core-02 docker[6535]: Hello World
Feb 13 17:56:51 core-02 docker[6535]: Hello World
Feb 13 17:56:52 core-02 docker[6535]: Hello World
cloud/coreos/fleet.1487008669.txt.gz · Last modified: 2017/02/13 09:57 by frank