Skip to content

Instantly share code, notes, and snippets.

@smothiki
Created July 16, 2015 01:24
Show Gist options
  • Save smothiki/19872d0f1f1ca8c927de to your computer and use it in GitHub Desktop.
Save smothiki/19872d0f1f1ca8c927de to your computer and use it in GitHub Desktop.
k8s docs
title:Choosing a Scheduler
description:How to choose a scheduler backend for Deis.

Choosing a Scheduler

The :ref:`scheduler` creates, starts, stops, and destroys each :ref:`container` of your app. For example, a command such as deis scale web=3 tells the scheduler to run three containers from the Docker image for your app.

Deis defaults to using the Fleet Scheduler. Tech previews of the Swarm Scheduler, `Mesos with Marathon framework`_ and Kubernetes are available for testing.

Note

If you are using a scheduler other than fleet app containers will not be rescheduled if deis-registry is unavailable. For more information look at deis-registry issue 3619.

Settings set by scheduler

The following etcd keys are set by the scheduler module of the controller component.

Some keys will exist only if a particular schedulerModule backend is enabled.

setting description
/deis/scheduler/swarm/host the swarm manager's host IP address
/deis/scheduler/swarm/node used to identify other nodes in the cluster
/deis/scheduler/mesos/marathon used to identify Marathon framework's host IP address
/deis/scheduler/k8s/master used to identify host IP address of kubernetes ApiService

Settings used by scheduler

The following etcd keys are used by the scheduler module of the controller component.

setting description
/deis/controller/schedulerModule scheduler backend, either "fleet" or "swarm" or "mesos_marathon" or "k8s" (default: "fleet")

Fleet Scheduler

fleet is a scheduling backend included with CoreOS:

fleet ties together systemd and etcd into a distributed init system. Think of it as an extension of systemd that operates at the cluster level instead of the machine level. This project is very low level and is designed as a foundation for higher order orchestration.

fleetd is already running on the machines provisioned for Deis: no additional configuration is needed. Commands such as deis ps:restart web.1 or deis scale cmd=10 will use fleet by default to manage app containers.

To use the Fleet Scheduler backend explicitly, set the controller's schedulerModule to "fleet":

$ deisctl config controller set schedulerModule=fleet

Swarm Scheduler

Important

The Swarm Scheduler is a technology preview and is not recommended for production use.

swarm is a scheduling backend for Docker:

Docker Swarm is native clustering for Docker. It turns a pool of Docker hosts into a single, virtual host.
Swarm serves the standard Docker API, so any tool which already communicates with a Docker daemon can use Swarm to transparently scale to multiple hosts...

Deis includes an enhanced version of swarm v0.2.0 with node failover and optimized locking on container creation. The Swarm Scheduler uses a soft affinity filter to spread app containers out among available machines.

Swarm requires the Docker Remote API to be available at TCP port 2375. If you are upgrading an earlier installation of Deis, please refer to the CoreOS documentation to enable the remote API.

Note

Known Issues

  • It is not yet possible to change the default affinity filter.
  • If swarm can't create all the containers requested, Deis returns an error and leaves some containers in the "created" state. Until this behavior is fixed, be mindful of resource limitations on your cluster.
  • App containers will not be rescheduled if deis-registry is unavailable.

To test the Swarm Scheduler backend, first install and start the swarm components:

$ deisctl install swarm && deisctl start swarm

Then set the controller's schedulerModule to "swarm":

$ deisctl config controller set schedulerModule=swarm

The Swarm Scheduler is now active. Commands such as deis destroy or deis scale web=9 will use swarm to manage app containers.

To monitor Swarm Scheduler operations, watch the logs of the swarm-manager component, or spy on Docker events directly on the swarm-manager machine:

Kubernetes Scheduler

Important

The Kubernetes Scheduler is a technology preview and is not recommended for production use.

Kubernetes orchestration system for docker containers:

Kubernetes provides APIs to manage, deploy and scale docker containers. Kubernetes deploys docker containers as PODS, unique entitiy across a cluster. Containers inside a POD share the same namespaces. More information about PODS.

To run kubernetes on CoreOS requires flannel which provides subnet to each host for use with containers runtimes. Deis repository provides a new user-data file to bootstrap CoreOs machines on the cluster with flannel.

To test the Kubernetes Scheduler, first install and start the kubernetes components:

$deisctl install k8s && deisctl start k8s

Then set the controller's schedulerModule to "k8s":

$ deisctl config controller set schedulerModule=k8s

The Kubernetes scheduler is now active. Commands such as deis destroy or deis scale web=9 will use `kubernetes ApiServer`_ to manage app PODS.

For each App deis creates a replicaiton controller which manages applicaiton PODS and a kubernetes service which acts as a proxy and routes traffic to the PODS associated with the App. A new release uses rolling deploy mechanism. If you are using kubernetes scheduler for Deis you can avoid publisher componenet.

Note

Known Issues

  • Kubernetes ApiServer is not HA. If ApiServer is rescheduled it won't effect the existing Apps but affects creation of new Apps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment