Use the 1&1 Docker InfraKit Instance Plugin

Table of Contents

Introduction

This is a Docker InfraKit instance plug-in for creating and managing 1&1 Cloud servers.

Development of the plug-in is ongoing, and attempts to follow changes and new features in the InfraKit itself.

Usage

Use the provided configuration example example1and1.json as a reference. Feel free to change the values of the properties.

$ cat << EOF > 1and1.json
{
    "ID": "myGroup",
    "Properties": {
        "Allocation": {
            "Size": 2
        },
        "Instance": {
            "Plugin": "instance-1and1",
            "Properties": {
                "Appliance": "centos7-64std",
                "Datacenter": "GB",
                "FixedServerSize": "L",
                "Password": "",
                "SSHKey": "",
                "SSHKeyPath": "/home/nb/.ssh/id_rsa.pub",
                "FirewallID": "",
                "LoadBalancerID": "",
                "MonitorPolicyID": ""
            }
        },
        "Flavor": {
            "Plugin": "flavor-vanilla",
            "Properties": {
                "Tags": {
                    "project": "test"
                }
            }
        }
    }
}
EOF

Commit the configuration by running the InfraKit command:

$ build/infrakit group commit 1and1.json
Committed myGroup: Managing 2 instances

Managing Groups

You can use the set of InfraKit commands to manage the groups being monitored.

$ build/infrakit group --help
Access group plugin

Usage:
  build/infrakit group [command]

Available Commands:
  commit      commit a group configuration
  describe    describe the live instances that make up a group
  destroy     destroy a group
  free        free a group from active monitoring, nondestructive
  inspect     return the raw configuration associated with a group
  ls          list groups

Flags:
      --name string   Name of plugin (default "group")

Global Flags:
      --log int   Logging level. 0 is least verbose. Max is 5 (default 4)

Use "build/infrakit group [command] --help" for more information about a command.

The group describe command displays info about the instances in a tabular form.

$ build/infrakit group describe myGroup 
ID                              LOGICAL                         TAGS
instance-3596758581874575275    77.68.13.219                    infrakit.config_sha=Cf4KpiVHyBBRTVR9XqOubrKB6kU=,infrakit.group=myGroup,project=test,serverID=FD7697A0FCE6E92DA9066BF8A53B1B12
instance-4696994370972658643    77.68.15.106                    infrakit.config_sha=Cf4KpiVHyBBRTVR9XqOubrKB6kU=,infrakit.group=myGroup,project=test,serverID=0ACC0C790843C1213F8B528A5985710C

If you would like to increase or decrease the number of instances in the group, modify the allocation Size property and commit the modified configuration.

$ build/infrakit group commit 1and1.json 
Committed myGroup: Adding 1 instances to increase the group size to 3
$ build/infrakit group commit 1and1.json 
Committed myGroup: Terminating 2 instances to reduce the group size to 1

Run the destroy command to terminate a group monitoring and delete all instances, i.e., servers in the group.

$ build/infrakit group destroy myGroup
destroy myGroup initiated

Configuration Parameters

  • Appliance - 1&1 server appliance ID or name.
  • Datacenter - 1&1 data center ID or country code.
  • FixedServerSize - 1&1 fixed-instance size used for the server.
  • Password - Password for the server.
  • SSHKey - SSH public key.
  • SSHKeyPath - Path to public SSH key.
  • FirewallID - 1&1 firewall policy ID.
  • LoadBalancerID - 1&1 load balancer ID.
  • MonitorPolicyID - 1&1 monitoring policy ID.

The required parameters are Appliance and FixedServerSize.

Design Notes

The plugin stores basic info about the instances onto the provided location (--dir). You can stop and start a group monitoring without redeploying the servers.

The instance file names consist of the instance (server) name and .1and1.spec extension. The numeric part of the file name (also server name) is generated randomly to avoid naming conflict when a group is scaled automatically.

Default values are provided for the following instance properties:

  • Appliance => ubuntu1404-64std
  • Datacenter => US
  • FixedServerSize => M

Either ID or name can be specified for Appliance and FixedServerSize, and ID or country code for Datacenter.

If SSHKey is provided, SSHKeyPath will be ignored.

Comments

Tags: Docker