No commit activity in last 3 years
No release in over 3 years
Creates rax clusters
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Knife Rackspace Cluster¶ ↑

Description:¶ ↑

This tool hooks into opscode’s knife-rackspace ruby gem. This plugin allows you to create rackspace “clusters”. A rackspace cluster is a group of nodes that are behind a cloud load balancer. This tool will build your nodes and automatically put them behind a cloud loadbalancer. This tool allows you to specify a blueprint file that contains: quantity of nodes, chef run list and environment, flavor and image to be used. Please use ruby 1.9 for best performance (i.e. threaded server deploys).

Installation¶ ↑

Install chef (as of right now this plugin has only been tested against chef 10.22.0):

sudo gem install chef --version 10.22.0

Install Make

sudo apt-get install make
sudo yum install make

To satisfy the requirements of the nokogiri gem you must also follow the instructions here:

http://nokogiri.org/tutorials/installing_nokogiri.html

Install the knife rackspace cluster Gem:

sudo gem install knife-rackspace-cluster

There are issues with fog 1.9.0 creating rackspace servers. This plugin has a version contraint on fog 1.8.0. If you already have 1.9.0 installed you can do the following until this is fixed:

sudo gem uninstall fog --version 1.9.0
sudo gem install fog --version 1.8.0

CONFIGURATION¶ ↑

You will need to make the following entries into your knife.rb file in order to communicate with the rackspace API:

knife[:rackspace_api_username] = "username"
knife[:rackspace_api_key] =  "api_key"
knife[:rackspace_version] = 'v2'
knife[:rackspace_endpoint] = "https://ord.servers.api.rackspacecloud.com/v2"

Please see the knife-rackspace readme for more details on configuring your knife.rb

SUBCOMMANDS:¶ ↑

This plugin provides the following sub commands:

knife rax cluster create¶ ↑

This command requires that you pass it a name for your cloud load balancer and the -B (blueprint) flag followed by a blueprint file. You can generate a template file by running:

knife rax cluster create -G

This will create a file called map_template.json in your current directory. An example template looks as follows:

{
    "blue_print" :
{
    "name_convention" : "web",
    "run_list" : [
        "recipe[apt]",
        "role[base]"
    ],
    "quantity" : 2,
    "chef_env" : "dev",
    "image_ref" : "c195ef3b-9195-4474-b6f7-16e5bd86acd0",
    "flavor" : 2
    }

}

This will tell the plugin to build 2 servers and use the settings specified. The servers will be named based on your name_convetion setting and random digits will be appeneded to the name. The servers will be built using threads if you’re using ruby 1.9. Once the servers have been built and bootstrapped with chef a load balancer will be created and the nodes will be added to the LB pool.

To create your cluster you can run the following command:

knife rax cluster create web_heads -B map_template.json -r ord

If you do not specify any other parameters this will create a load balancer that is listening on port 80 using the ROUND_ROBIN algorithm. It will also rename the load balancer to web_heads_cluster so the plugin can search for valid clusters using the list sub command. You must specify the -r(region) switch to tell the plugin what data center to create your load balancer in.

knife rax cluster list¶ ↑

This command will look for any load balancers in the specified data center with the name suffixed by _cluster. It will return the load balancer name, Load balancer id, LB algorithm, LB protocol, LB node Count. You must specify the -r (region) to tell the plugin what data center to look in.

Example:

knife rax cluster list -r ord

knife rax cluser show ¶ ↑

This command takes a load balancer ID of one of your clusters and the -r switch to tell the tool what region the LB resides. It will display information regarding the LB and the nodes belonging to it.

Example:

knife rax cluster show LB_ID -r ord

knife rax cluster change¶ ↑

This command will allow you to change the chef environment and chef run_lists of the existing members of the cluster. You will need to pass the plugin a load balancer ID of your cluster and the –run-list or the –chef-env flags. Examples

knife rax cluster change 1234 --run-list 'recipe[apt],role[base]'
knife rax cluster change 1234 --chef-env prod

knife rax cluster expand¶ ↑

This command will allow you to add additional nodes to an existing rax cluster. You will need to pass it a load balancer ID that you wish to add nodes to as well as the -B (blueprint) flag for instructions on the new nodes.

Example:

knife rax cluster expand 1234 -B map_template.json -r ord

knife rax cluster delete¶ ↑

This command takes the load balancer ID as an argument and the -r (region) switch. Running this command will delete all the servers that are apart of the cluster from the rackspace cloud as well as from your chef server.

Example:

knife rax cluster delete 1234 -r ord

Troubleshooting¶ ↑

If you run into errors such as this:

Fog::Compute::RackspaceV2::BadRequest: Fog::Compute::RackspaceV2::BadRequest

Make sure to check that values in your blue print file are valid. For example if you specify an incorrect image or flavor you may see this message. Also check that you are passing the correct rackspace username and api key.

It’s recomended to use Ruby 1.9 and gems 1.8 with this plugin. If you’re having trouble installing ruby 1.9 with your OS, try using chef’s installer located here:

http://www.opscode.com/chef/install/

This will put ruby and gems under:

/opt/chef/embedded/bin

This is a quick way to get ruby 1.9 running on a system.

LICENSE¶ ↑

Author

Zack Feldstein (<zack.feldstein@rackspace.com>)

Copyright

Copyright © 2013 Zack Feldstein

License

Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.