Skip to content

Live-migrate Nova VMs and disable scheduling when a Kubernetes node is drained.

License

Notifications You must be signed in to change notification settings

stackanetes/nova-kubernetes-drain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nova-kubernetes-drain

Build Status Container Repository on Quay Go Report Card

The main goal of Nova-kubernetes-drain is to perform live-evacuation of OpenStack compute node when Kubernetes node is being drained. Nova-kubernetes-drain should be deployed as a Daemonset via Stackanetes.

Nova-kubernetes-drain can be run as a daemon or as one-off task. Those two modes are simple configure by command line flag.

Requirements

Nova-kubernetes-drain is based on the following clients:

  1. Kubernetes client: https://godoc.org/k8s.io/kubernetes/pkg/client/unversioned
  2. OpenStack client*: http://gophercloud.io/docs/compute/

* Rackspace client is deprecated, but the new client currently does not support live-migration. The Client should be switched when the client supports live-migration.

Configuration file

Nova-kubernetes-drain requires a configuration file, by default named config.yaml. Configuration file should contain all variables necessary to establish connection with openstack. config.yaml example:

IdentityEndpoint: "http://keystone-api:5000/v3/"
Username: "admin"
Password: "mysupersecretpassword"
TenantName: "admin"
DomainID: "default"

Run once

Run once is the default mode. To perform an evacuation, simply run the application without any additional flags. Flag -config-path is optional. Once the evacuation is successful, the application will exit without any error code.

To run it:

./drainer -config-path=<configuration-file-name>

The application will execute following actions:

  1. Get authorization data from configuration file.
  2. Determine the name of the running hypervisor in OpenStack.
  3. Disable scheduling of VMs on this node in OpenStack.
  4. Identify all VMs on this node.
  5. Trigger a live-migration.
  6. Exit the application if all VMs are migrated or timeout is reached.

Daemon

To run Nova-kubernetes-drain as a daemon. One has to pass additional -daemon flag.

./drainer -daemon -config-path=<configuration-file-name>

In this mode, the application will wait for specific Kubernetes events to take actions. A Kubernetes drain operation will disable scheduling of new VMs and perform live-evacuation of the currently running VMs. On the other hand, a Kubernetes uncordon operation will re-enable the scheduling.

Lifecycle of the application:

  1. Load Openstack authorization variables from file.
  2. Hook to Kubernetes event stream and wait for proper events.
  3. According to the event message, trigger the appropriate operation:
    1. Unschedulable event received:
      1. Disable nova-compute in Openstack.
      2. Identify all VMs on this nova-compute node.
      3. Trigger live-migration for each of those VMs.
    2. Schedulable event received:
      1. Enable nova-compute in Openstack.

About

Live-migrate Nova VMs and disable scheduling when a Kubernetes node is drained.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages