diff --git a/cluster/aws/config-default.sh b/cluster/aws/config-default.sh index 610f656f9cb..79037c59de2 100644 --- a/cluster/aws/config-default.sh +++ b/cluster/aws/config-default.sh @@ -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 diff --git a/cluster/aws/config-test.sh b/cluster/aws/config-test.sh index fc9d93e8c5e..63e8519bd1e 100755 --- a/cluster/aws/config-test.sh +++ b/cluster/aws/config-test.sh @@ -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} diff --git a/cluster/aws/options.md b/cluster/aws/options.md index 31a3b3ca6c2..9db6e60af01 100644 --- a/cluster/aws/options.md +++ b/cluster/aws/options.md @@ -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`. diff --git a/docs/getting-started-guides/aws.md b/docs/getting-started-guides/aws.md index 72a6bb8d13c..41d844047ed 100644 --- a/docs/getting-started-guides/aws.md +++ b/docs/getting-started-guides/aws.md @@ -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.