starting with fleet

mohammedrafi@NOC-RAFI:~/gitdata/coreos-vagrant$ vagrant ssh core-01
Last login: Sun Apr 2 11:45:16 UTC 2017 from 10.0.2.2 on ssh
Container Linux by CoreOS stable (1298.6.0)

To list machines in cluster
core@core-01 ~ $ fleetctl list-machines
MACHINE IP METADATA
0589cb6e… 172.17.8.102 –
5e1982e0… 172.17.8.103 –
cb31de94… 172.17.8.101 –

To list unit files submitted to cluster

core@core-01 ~ $ fleetctl list-unit-files
UNIT HASH DSTATE STATE TARGET

To list current uit files running

core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB

core@core-01 ~ $ vim hellofleet.service
[Unit]
Description=Hello Fleet Service
After=docker.service
Requires=docker.serivce

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill hello-fleet
ExecStartPre=-/usr/bin/docker rm hello-fleet
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run –name hello-fleet busybox /bin/sh -c “while true;do echo Hello fleet;sleep 1;done”
ExecStop=-/usr/bin/docker rm -f hello-fleet
core@core-01 ~ $ fleetctl submit hellofleet.service
Unit hellofleet.service inactive

core@core-01 ~ $ fleetctl list-unit-files
UNIT HASH DSTATE STATE TARGET
hellofleet.service 0c46353 inactive inactive –

core@core-01 ~ $ fleetctl submit hellofleet.service
Unit hellofleet.service inactive

core@core-01 ~ $ fleetctl load hellofleet
Unit hellofleet.service loaded on 0589cb6e…/172.17.8.102

core@core-01 ~ $ fleetctl list-unit-files
UNIT HASH DSTATE STATE TARGET
hellofleet.service 0c46353 loaded loaded 0589cb6e…/172.17.8.102

core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB
hellofleet.service 0589cb6e…/172.17.8.102 inactive dead

core@core-01 ~ $ fleetctl start hellofleet
Unit hellofleet.service launched on 0589cb6e…/172.17.8.102
core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB
hellofleet.service 0589cb6e…/172.17.8.102 activating start-pre
core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB
hellofleet.service 0589cb6e…/172.17.8.102 active running

core@core-01 ~ $ fleetctl status hellofleet
The authenticity of host ‘172.17.8.102’ can’t be established.
ECDSA key fingerprint is 3e:0f:5e:ff:e6:29:6c:ad:70:ce:e2:6e:97:86:15:77.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘172.17.8.102’ (ECDSA) to the list of known hosts.
Error running remote command: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

mohammedrafi@NOC-RAFI:~/gitdata/coreos-vagrant$ ssh-add ~/.vagrant.d/insecure_private_key
Identity added: /home/mohammedrafi/.vagrant.d/insecure_private_key (/home/mohammedrafi/.vagrant.d/insecure_private_key)
core@core-01 ~ $ fleetctl status hellofleet
● hellofleet.service – Hello Fleet Service
Loaded: loaded (/run/fleet/units/hellofleet.service; linked-runtime; vendor preset: disabled)
Active: active (running) since Sun 2017-04-02 12:10:07 UTC; 13min ago
Process: 1888 ExecStartPre=/usr/bin/docker pull busybox (code=exited, status=0/SUCCESS)
Process: 1881 ExecStartPre=/usr/bin/docker rm hello-fleet (code=exited, status=1/FAILURE)
Process: 1761 ExecStartPre=/usr/bin/docker kill hello-fleet (code=exited, status=1/FAILURE)
Main PID: 1901 (docker)
Tasks: 6
Memory: 18.7M
CPU: 262ms
CGroup: /system.slice/hellofleet.service
└─1901 /usr/bin/docker run –name hello-fleet busybox /bin/sh -c while true;do echo Hello fleet;sleep 1;done

Apr 02 12:23:04 core-02 docker[1901]: Hello fleet
Apr 02 12:23:05 core-02 docker[1901]: Hello fleet

core@core-01 ~ $ fleetctl journal hellofleet
— Logs begin at Fri 2017-03-31 09:50:22 UTC, end at Sun 2017-04-02 12:24:06 UTC. —
Apr 02 12:23:56 core-02 docker[1901]: Hello fleet
Apr 02 12:23:57 core-02 docker[1901]: Hello fleet
Apr 02 12:23:58 core-02 docker[1901]: Hello fleet
Apr 02 12:23:59 core-02 docker[1901]: Hello fleet
Apr 02 12:24:00 core-02 docker[1901]: Hello fleet
Apr 02 12:24:01 core-02 docker[1901]: Hello fleet
Apr 02 12:24:02 core-02 docker[1901]: Hello fleet
Apr 02 12:24:03 core-02 docker[1901]: Hello fleet
Apr 02 12:24:04 core-02 docker[1901]: Hello fleet
Apr 02 12:24:05 core-02 docker[1901]: Hello fleet
core@core-01 ~ $ fleetctl stop hellofleet
Unit hellofleet.service loaded on 0589cb6e…/172.17.8.102

core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB
hellofleet.service 0589cb6e…/172.17.8.102 failed failed

core@core-01 ~ $ fleetctl destroy hellofleet
Destroyed hellofleet.service
core@core-01 ~ $ fleetctl list-units

UNIT MACHINE ACTIVE SUB
core@core-01 ~ $ fleetctl list-unit-files
UNIT HASH DSTATE STATE TARGET

core@core-01 ~ $ fleetctl start hellofleet
Unit hellofleet.service inactive
Unit hellofleet.service launched on 0589cb6e…/172.17.8.102

core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB
hellofleet.service 0589cb6e…/172.17.8.102 activating start-pre

core@core-01 ~ $ fleetctl list-unit-files
UNIT HASH DSTATE STATE TARGET
hellofleet.service 0c46353 launched launched 0589cb6e…/172.17.8.102

################# Global service ################
core@core-01 ~ $ vim global.service

[Unit]
Description=Global Hello Service
After=docker.service
Requires=docker.serivce

[Service]
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill global-hello
ExecStartPre=-/usr/bin/docker rm global-hello
ExecStartPre=/usr/bin/docker pull busybox
ExecStart=/usr/bin/docker run –name global-hello busybox /bin/sh -c “while true;do echo global-hello ;sleep 1;done”
ExecStop=-/usr/bin/docker rm -f hello-fleet

[X-Fleet]
Global=true
core@core-01 ~ $ fleetctl start global.service
Unit global.service
Triggered global unit global.service start

core@core-01 ~ $ fleetctl list-unit-files
UNIT HASH DSTATE STATE TARGET
global.service 80d32a1 launched – global

core@core-01 ~ $ fleetctl list-units
UNIT MACHINE ACTIVE SUB
global.service 0589cb6e…/172.17.8.102 active running
global.service 5e1982e0…/172.17.8.103 active running
global.service cb31de94…/172.17.8.101 active running

core@core-01 ~ $ fleetctl status global
Unable to determine status of global unit global.service.

core@core-01 ~ $ fleetctl journal global.service
Unable to retrieve journal of global unit global.service.

core@core-01 ~ $ journalctl -f -u global.service
— Logs begin at Fri 2017-03-31 09:49:37 UTC. —
Apr 02 13:23:40 core-01 docker[1750]: global-hello
Apr 02 13:23:41 core-01 docker[1750]: global-hello
Apr 02 13:23:42 core-01 docker[1750]: global-hello
Apr 02 13:23:43 core-01 docker[1750]: global-hello
Apr 02 13:23:44 core-01 docker[1750]: global-hello

core@core-01 ~ $ systemctl status global
● global.service – Global Hello Service
Loaded: loaded (/run/fleet/units/global.service; linked-runtime; vendor preset: disabled)
Active: active (running) since Sun 2017-04-02 13:20:32 UTC; 3min 45s ago
Process: 1740 ExecStartPre=/usr/bin/docker pull busybox (code=exited, status=0/SUCCESS)
Process: 1735 ExecStartPre=/usr/bin/docker rm global-hello (code=exited, status=1/FAILURE)
Process: 1577 ExecStartPre=/usr/bin/docker kill global-hello (code=exited, status=1/FAILURE)
Main PID: 1750 (docker)
Tasks: 5
Memory: 16.6M
CPU: 139ms
CGroup: /system.slice/global.service
└─1750 /usr/bin/docker run –name global-hello busybox /bin/sh -c while true;do echo global-hello ;sleep 1;done

Apr 02 13:24:09 core-01 docker[1750]: global-hello
Apr 02 13:24:10 core-01 docker[1750]: global-hello
Apr 02 13:24:11 core-01 docker[1750]: global-hello
Apr 02 13:24:12 core-01 docker[1750]: global-hello

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s