Learning CoreOS by Kingston Smiler. S & Shantanu Agrawal

Learning CoreOS by Kingston Smiler. S & Shantanu Agrawal

Author:Kingston Smiler. S & Shantanu Agrawal [S, Kingston Smiler.]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2016-03-21T23:00:00+00:00


Node-level affinity

This mechanism uses the systemd generated machine ID to schedule the services. Upon member installation, systemd generates a machine ID that is the same across subsequent system boots. Node-level affinity ensures the user targets a service onto a member and nowhere else. When thinking about clusters where it's more flexible to schedule a service based on member properties rather than on member identifiers, this mechanism has limited use. Typical use cases can be running a service to collect specific data from a machine, or for testing a service where a new service can be scheduled on a test member for observing the behavior.

The following is the cloud-config file used to create the cluster. This file also creates a service unit file in the home directory that will be used by fleet to start the service.

#cloud-config write_files: - path: /home/core/example_test.service owner: core:core permissions: 420 content: | [Unit] Description=Example After=docker.service Requires=docker.service [X-Fleet] MachineID=dummy [Service] TimeoutStartSec=0 ExecStartPre=-/usr/bin/docker kill sampleserv_test ExecStartPre=-/usr/bin/docker rm sampleserv_test ExecStartPre=/usr/bin/docker pull busybox ExecStart=/usr/bin/docker run --name sampleserv_test busybox /bin/sh -c "while true; do echo Test Service; sleep 300; done" ExecStop=/usr/bin/docker stop sampleserv_test ... units: - name: etcd2.service command: start enable: true - name: fleet.service command: start enable: true



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.