<p>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. </p>

<ol>
<li>Is it possible to auto-scale the number of cluster machines based on (for example) CPU load?</li>
<li>If this is not supported, is there a reason why or is Google working on something like this for the future?</li>
</ol>

<p>Yes, it is. To attach an autoscaler to your existing GKE cluster:</p>

<ol>
<li><p>Find the name of your cluster's instance group:</p>

<pre><code>$ 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
</code></pre>

<p>Here I have a GKE cluster named <em>buildlets</em>, and its instance group is named <em>gke-buildlets-6989e2d-group</em></p></li>
<li><p>Enable autoscaling. This particular example will scale on a target CPU utilization of 70%:</p>

<pre><code>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
</code></pre></li>
</ol>

<p>You can also use <a href="https://cloud.google.com/deployment-manager/overview">Google Cloud Deployment manager</a> to create your GKE cluster, and create/attach an autoscaler right along with it:</p>

<pre><code>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`
</code></pre>
