Make AWS node sizes dynamic in the number of nodes.

pull/6/head
Brendan Burns 2015-10-22 14:33:27 -07:00
parent d3862d453f
commit d32e713b77
4 changed files with 60 additions and 5 deletions

View File

@ -15,10 +15,33 @@
# limitations under the License.
ZONE=${KUBE_AWS_ZONE:-us-west-2a}
MASTER_SIZE=${MASTER_SIZE:-t2.micro}
MINION_SIZE=${MINION_SIZE:-t2.micro}
MASTER_SIZE=${MASTER_SIZE:-}
MINION_SIZE=${MINION_SIZE:-}
NUM_MINIONS=${NUM_MINIONS:-4}
# Dynamically set node sizes so that Heapster has enough space to run
if [[ -z ${MINION_SIZE} ]]; then
if (( ${NUM_MINIONS} < 50 )); then
MINION_SIZE="t2.micro"
elif (( ${NUM_MINIONS} < 150 )); then
MINION_SIZE="t2.small"
else
MINION_SIZE="t2.medium"
fi
fi
# Dynamically set the master size by the number of nodes, these are guesses
# TODO: gather some data
if [[ -z ${MASTER_SIZE} ]]; then
if (( ${NUM_MINIONS} < 50 )); then
MASTER_SIZE="t2.micro"
elif (( ${NUM_MINIONS} < 150 )); then
MASTER_SIZE="t2.small"
else
MASTER_SIZE="t2.medium"
fi
fi
# Optional: Set AWS_S3_BUCKET to the name of an S3 bucket to use for uploading binaries
# (otherwise a unique bucket name will be generated for you)
# AWS_S3_BUCKET=kubernetes-artifacts

View File

@ -15,10 +15,35 @@
# limitations under the License.
ZONE=${KUBE_AWS_ZONE:-us-west-2a}
MASTER_SIZE=${MASTER_SIZE:-t2.micro}
MINION_SIZE=${MINION_SIZE:-t2.micro}
MASTER_SIZE=${MASTER_SIZE:-}
MINION_SIZE=${MINION_SIZE:-}
NUM_MINIONS=${NUM_MINIONS:-2}
# Dynamically set node sizes so that Heapster has enough space to run
if [[ -z ${MINION_SIZE} ]]; then
if (( ${NUM_MINIONS} < 50 )); then
MINION_SIZE="t2.micro"
elif (( ${NUM_MINIONS} < 150 )); then
MINION_SIZE="t2.small"
else
MINION_SIZE="t2.medium"
fi
fi
# Dynamically set the master size by the number of nodes, these are guesses
# TODO: gather some data
if [[ -z ${MASTER_SIZE} ]]; then
if (( ${NUM_MINIONS} < 50 )); then
MASTER_SIZE="t2.micro"
elif (( ${NUM_MINIONS} < 150 )); then
MASTER_SIZE="t2.small"
else
MASTER_SIZE="t2.medium"
fi
fi
# Because regions are globally named, we want to create in a single region; default to us-east-1
AWS_S3_REGION=${AWS_S3_REGION:-us-east-1}

View File

@ -29,7 +29,7 @@ AWS_S3_REGION is useful for people that want to control their data location, bec
**MASTER_SIZE**, **MINION_SIZE**
The instance type to use for creating the master/minion. Defaults to t2.micro.
The instance type to use for creating the master/minion. Defaults to auto-sizing based on the number of nodes (see below).
For production usage, we recommend bigger instances, for example:
@ -38,6 +38,10 @@ export MASTER_SIZE=c4.large
export MINION_SIZE=r3.large
```
If you don't specify master and minion sizes, the scripts will attempt to guess the correct size of the master and worker nodes based on `${NUM_MINIONS}`.
In particular for clusters less than 50 nodes it will
use a `t2.micro` for clusters between 50 and 150 nodes it will use a `t2.small` and for clusters with greater than 150 nodes it will use a `t2.medium`.
Please note: `kube-up` utilizes ephemeral storage available on instances for docker storage. EBS-only instance types do not
support ephemeral storage and will default to docker storage on the root disk which is usually only 8GB.
EBS-only instance types include `t2`, `c4`, and `m4`.

View File

@ -91,6 +91,9 @@ export INSTANCE_PREFIX=k8s
...
```
The scripts will attempt to guess the correct size of the master and worker nodes based on `${NUM_MINIONS}`, in particular for clusters less than 50 nodes it will
use a `t2.micro` for clusters between 50 and 150 nodes it will use a `t2.small` and for clusters with greater than 150 nodes it will use a `t2.medium`.
It will also try to create or reuse a keypair called "kubernetes", and IAM profiles called "kubernetes-master" and "kubernetes-minion".
If these already exist, make sure you want them to be used here.