This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
cloud:coreos:fleet [2017/02/13 09:57] frank created |
cloud:coreos:fleet [2017/02/13 10:39] (current) frank |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | fleet is deprecated by coreos, is replaced by kubernetes. | + | ==== Intro ==== |
+ | |||
+ | **<del>fleet is deprecated</del> by [[cloud:coreos]], is replaced by [[cloud:kubernetes]].** | ||
fleet, a simple distributed service manager. | fleet, a simple distributed service manager. | ||
+ | fleet requires etcd | ||
+ | |||
+ | |||
+ | ==== Get started ==== | ||
+ | === remote fleet access (vagrant) === | ||
+ | host:<code bash> | ||
+ | |||
+ | ## add vagrant ssh keys | ||
+ | $ eval $(ssh-agent) | ||
+ | $ valgrant ssh-config | ||
+ | Host core-01 | ||
+ | HostName 127.0.0.1 | ||
+ | User core | ||
+ | Port 2200 | ||
+ | UserKnownHostsFile /dev/null | ||
+ | StrictHostKeyChecking no | ||
+ | PasswordAuthentication no | ||
+ | IdentityFile /root/.vagrant.d/insecure_private_key | ||
+ | IdentitiesOnly yes | ||
+ | LogLevel FATAL | ||
+ | ForwardAgent yes | ||
+ | |||
+ | Host core-02 | ||
+ | HostName 127.0.0.1 | ||
+ | User core | ||
+ | Port 2201 | ||
+ | UserKnownHostsFile /dev/null | ||
+ | StrictHostKeyChecking no | ||
+ | PasswordAuthentication no | ||
+ | IdentityFile /root/.vagrant.d/insecure_private_key | ||
+ | IdentitiesOnly yes | ||
+ | LogLevel FATAL | ||
+ | ForwardAgent yes | ||
+ | |||
+ | Host core-03 | ||
+ | HostName 127.0.0.1 | ||
+ | User core | ||
+ | Port 2202 | ||
+ | UserKnownHostsFile /dev/null | ||
+ | StrictHostKeyChecking no | ||
+ | PasswordAuthentication no | ||
+ | IdentityFile /root/.vagrant.d/insecure_private_key | ||
+ | IdentitiesOnly yes | ||
+ | LogLevel FATAL | ||
+ | ForwardAgent yes | ||
+ | |||
+ | ## we can add the keys by 'vagrant ssh-config | sed -n "s/IdentityFile//gp"|xargs ssh-ad' | ||
+ | $ ssh-add /root/.vagrant.d/insecure_private_key | ||
+ | $ ssh-add -l | ||
+ | ## ssh forward with -A, this is same as 'ssh -p 2202 -i /root/.vagrant.d/insecure_private_key core@127.0.0.1' | ||
+ | $ vagrant ssh core-03 -- -A | ||
+ | </code> | ||
- | Get started | + | === demo === |
+ | Run a busybox docker container and echo hello world in the container. | ||
+ | When we start the unit, it will be running on one of the machines in the cluster. | ||
<code bash> | <code bash> | ||
Line 121: | Line 177: | ||
Feb 13 17:56:52 core-02 docker[6535]: Hello World | Feb 13 17:56:52 core-02 docker[6535]: Hello World | ||
+ | </code> | ||
+ | ==== fleet units === | ||
+ | === standard units === | ||
+ | Standard units are long-running processes that are scheduled onto a single machine. If that machine goes offline, the unit will be migrated onto a new machine and started. | ||
+ | |||
+ | === global units === | ||
+ | Global units run on all machines in the cluster. A regular unit with a new<code> | ||
+ | [X-Fleet] | ||
+ | Global=true | ||
+ | </code> | ||
+ | When we start this unit, it will be running on all machines in cluster. | ||
+ | |||
+ | === unit high availability === | ||
+ | When we start the unit services, they will be running on different machines in the cluster. | ||
+ | Create unit file with<code> | ||
+ | [X-Fleet] | ||
+ | Conflicts=apache@*.service | ||
+ | </code> | ||
+ | Start multiple units | ||
+ | <code> | ||
+ | $ fleetctl start apache@1.service | ||
+ | $ fleetctl start apache@2.service | ||
</code> | </code> | ||
+ | The two services won't be run on same machine. When a machine fails to heartbeat back to the fleet leader, all units running on that machine are marked for rescheduling, units are started on new machine. Units that can't be rescheduled will remain stopped until the failed machine recovers. | ||