Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

a few more things... #32

Merged
merged 2 commits into from
Mar 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ some points to keep note too:

- If you want to make that persistent across shells and reboots do instead...

`./kubLocalSetup shellinit >> ˜/.bash_profile`
`./kubLocalSetup shellinit >> ~/.bash_profile`
- If you want to validate the environment variables we just set, run...

`./kubLocalSetup shellinit`
Expand Down Expand Up @@ -145,6 +145,12 @@ All aspects of your cluster setup can be customized with environment variables.
You can create/update a *~/.dockercfg* file at any time
by running `docker login <registry>.<domain>`. All nodes will get it automatically,
at 'vagrant up', given any modification or update to that file.

- **ETCD_CLUSTER_SIZE** sets the number of nodes in the default built-in etcd
cluster.

Defaults to **3** (or the total number of nodes of the cluster if lower).

- **KUBERNETES_VERSION** defines the specific kubernetes version being used.

Currently we are defaulting to **0.11.0**, which is the last released version.
Expand All @@ -169,20 +175,30 @@ $(./kubLocalSetup shellinit)
### Set-up cluster

```
vagrant up master
NODE_MEM=2048 NODE_CPUS=1 NUM_INSTANCES=2 vagrant up
```

Wait until ```master``` has finished downloading Kubernetes binaries and provisioned a Docker mirror cache. This can take a few minutes depending on your Internet speed. After that, bring up a couple minions:
This will start the `master` and 2 `minion` nodes. On them a local etcd
cluster will be bootstrapped, Kubernetes binaries will be downloaded and
all needed services started, as a *bonus* a docker mirror cache will be
provisioned in the `master`, to speed up container provisioning. This
can take a little bit depending on your Internet connection speed.

```
NODE_MEM=2048 NODE_CPUS=1 NUM_INSTANCES=2 vagrant up
```
Please do note that, at any time, you can increase the number of running
`minion` VMs by increasing the `NUM_INSTANCES` value in subsequent
`vagrant up` invocations.

### Usage

## Usage
Congratulations! You're now ready to use your Kubernetes cluster.

You're now ready to use your Kubernetes cluster.
If you just want to test something simple, start with [Kubernetes examples]
(https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/).

If you just want to test something simple, start with [Kubernetes examples](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/examples/).
For a more elaborate scenario [here]
(https://github.com/pires/kubernetes-elasticsearch-cluster) you'll find all
you need to get a scalable Elasticsearch cluster on top of Kubernetes in no
time.

## Licensing

Expand Down
48 changes: 33 additions & 15 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

require 'fileutils'
require 'net/http'
require 'open-uri'

class Module
def redefine_const(name, value)
__send__(:remove_const, name) if const_defined?(name)
const_set(name, value)
end
end

required_plugins = %w(vagrant-triggers)
required_plugins.each do |plugin|
need_restart = false
Expand All @@ -15,17 +26,6 @@ end
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.6.0"

require 'fileutils'
require 'net/http'
require 'open-uri'

class Module
def redefine_const(name, value)
__send__(:remove_const, name) if const_defined?(name)
const_set(name, value)
end
end

MASTER_YAML = File.join(File.dirname(__FILE__), "master.yaml")
NODE_YAML = File.join(File.dirname(__FILE__), "node.yaml")

Expand Down Expand Up @@ -65,9 +65,24 @@ MASTER_CPUS = ENV['MASTER_CPUS'] || 1
NODE_MEM= ENV['NODE_MEM'] || 1024
NODE_CPUS = ENV['NODE_CPUS'] || 1

ETCD_CLUSTER_SIZE = ENV['ETCD_CLUSTER_SIZE'] || 3

SERIAL_LOGGING = (ENV['SERIAL_LOGGING'].to_s.downcase == 'true')
GUI = (ENV['GUI'].to_s.downcase == 'true')

(1..(NUM_INSTANCES.to_i + 1)).each do |i|
case i
when 1
ETCD_SEED_CLUSTER = ""
hostname = "master"
else
hostname = ",node-%02d" % (i - 1)
end
if i <= ETCD_CLUSTER_SIZE
ETCD_SEED_CLUSTER.concat("#{hostname}=http://172.17.8.#{i+100}:2380")
end
end

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# always use Vagrants' insecure key
config.ssh.insert_key = false
Expand All @@ -77,6 +92,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box_version = ">= #{COREOS_VERSION}"
config.vm.box_url = "#{upstream}/coreos_production_vagrant.json"

config.trigger.after [:up, :resume] do
info "making sure ssh agent has the default vagrant key..."
system "ssh-add ~/.vagrant.d/insecure_private_key"
end

["vmware_fusion", "vmware_workstation"].each do |vmware|
config.vm.provider vmware do |v, override|
override.vm.box_url = "#{upstream}/coreos_production_vagrant_vmware_fusion.json"
Expand Down Expand Up @@ -184,13 +204,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
inline: <<-EOF
sed -i "s,__RELEASE__,v#{KUBERNETES_VERSION},g" /tmp/vagrantfile-user-data
sed -i "s,__CHANNEL__,v#{CHANNEL},g" /tmp/vagrantfile-user-data
sed -i "s,__NAME__,#{hostname},g" /tmp/vagrantfile-user-data
sed -i "s|__ETCD_SEED_CLUSTER__|#{ETCD_SEED_CLUSTER}|g" /tmp/vagrantfile-user-data
mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/
EOF
end
end
end
config.trigger.after [:up, :resume] do
info "making sure ssh agent has the default vagrant key..."
system "ssh-add ~/.vagrant.d/insecure_private_key"
end
end
Loading