When you create a Google Container Engine (GKE) cluster you specify what the number and what types of machines you want to use in the cluster.
You can definitely create an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster. So the autoscaler will be created and will be using the replication controller as a reference to automatically increase or decrease the number of pods as needed. You can have more information in this Help Center article.
Yes, it is. To attach an autoscaler to your existing GKE cluster:
Find the name of your cluster's instance group:
$ gcloud compute instance-groups managed list
NAME ZONE BASE_INSTANCE_NAME SIZE TARGET_SIZE INSTANCE_TEMPLATE AUTOSCALED
gke-buildlets-69898e2d-group us-central1-f gke-buildlets-69898e2d-node 1 1 gke-buildlets-69898e2d-1-1-3 yes
Here I have a GKE cluster named buildlets, and its instance group is named gke-buildlets-6989e2d-group
Enable autoscaling. This particular example will scale on a target CPU utilization of 70%:
gcloud compute instance-groups managed set-autoscaling YOUR_INSTANCE_GROUP_NAME \
--zone=YOUR_INSTANCE_GROUP_ZONE \
--min-num-replicas=1 \
--max-num-replicas=8 \
--scale-based-on-cpu \
--target-cpu-utilization=.7
You can also use Google Cloud Deployment manager to create your GKE cluster, and create/attach an autoscaler right along with it:
resources:
- name: buildlets
type: container.v1.cluster
properties:
zone: us-central1-f
cluster:
initial_node_count: 1
network: "default"
logging_service: "logging.googleapis.com"
monitoring_service: "monitoring.googleapis.com"
node_config:
machine_type: n1-standard-1
oauth_scopes:
- "https://www.googleapis.com/auth/cloud-platform"
master_auth:
username: admin
password: password123
- name: autoscaler
type: compute.v1.autoscaler
properties:
zone: us-central1-f
name: buildlets
target: "$(ref.buildlets.instanceGroupUrls[0])"
autoscalingPolicy:
minNumReplicas: 2
maxNumReplicas: 8
coolDownPeriodSec: 600
cpuUtilization:
utilizationTarget: .7`
It is possible to manually resize a GKE cluster, yes. AFAIK you'd need to do the 'elastic' part yourself ATM, for example based on Heapster output.