Elastic Google 容器引擎集群?

Elastic Google Container Engine cluster?

当您创建 Google 容器引擎 (GKE) 集群时,您可以指定要在集群中使用的机器数量和类型。

  1. 是否可以根据(例如)CPU 负载自动调整集群机器的数量?
  2. 如果不支持,是否有原因或 Google 正在为将来做这样的事情?

可以手动resize a GKE cluster,是的。 AFAIK 你需要自己做 'elastic' 部分 ATM,例如基于 Heapster 输出。

您绝对可以创建一个自动缩放器,自动选择和设置 kubernetes 集群中 pods 和 运行 的数量。因此,将创建自动缩放器,并将使用复制控制器作为参考,根据需要自动增加或减少 pods 的数量。您可以在 Help Center article.

中获得更多信息

是的,是的。要将自动调节程序附加到您现有的 GKE 集群:

  1. 查找集群实例组的名称:

    $ 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
    

    这里我有一个名为buildlets的GKE集群,它的实例组名为gke-buildlets-6989e2d-group

  2. 启用自动缩放。这个特定的例子将扩展目标 CPU 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
    

您还可以使用 Google Cloud Deployment manager 创建您的 GKE 集群,create/attach 一个自动缩放器随之而来:

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`