Kubernetes pod自动缩放与实例组自动缩放不同步 [英] Kubernetes pod autoscaling out of sync with Instance Group autoscaling

查看:226
本文介绍了Kubernetes pod自动缩放与实例组自动缩放不同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的wordpress网站,由 ReplicationController Service 定义。一旦应用程序部署并且运行愉快,我可以通过访问GCE控制台并使用相同设置(最大5,cpu 10)启用自动调节来启用由Kubernetes创建的实例组的自动调节。 b
$ b

自动缩放实例和豆荚似乎工作得不错,除非它们彼此保持不同步。 RC自动缩放会从CE实例中移除窗格,但实例不会发生任何反应,因此它们会在LB运行状况检查失败并将其删除之前启动失败请求。



有没有办法为了让Kubernetes缩放这些豆荚,并且缩放它们运行的​​安装位置,所以这种情况不会发生?或者有什么办法让它们保持同步?



我的过程如下:

创建群集



$ gcloud container clusters create wordpress -z us-central1 -c -m f1-micro $ b

创建rc



$ kubectl create -f rc.yml



创建服务



$ kubectl create -f service.yml



自动调整rc



$ kubectl autoscale rc frontend --max 5 --cpu-percent = 10



然后我在控制台中启用了自动缩放功能,并给服务器加载以使它们扩展。

rc.yml <

$ p $ apiVersion:v1
类型:ReplicationController
元数据:
名称:frontend
规格:
副本:1
模板:
元数据:
标签:
应用程序:wordpress
规格:
容器:
- image:custom-wordpress-image
name:wordpress
ports:
- containerPort:80 $ b $ hostPort:80

service.yml
$ b

  apiVersion :v1 
kind:服务
元数据:
标签:
名称:前端
名称:前端
规格:
类型:LoadBalancer
端口:
- 端口:80
targetPort:80
协议:TCP
选择器:
名称:wordpress






更新资讯



如果我不使用kubernetes autoscaler,而是将副本设置为与实例组autoscaler max实例数相同的数字,我似乎得到了所需的结果。当实例被添加到实例组中时,kubernetes会对它们进行规定,因为它们会相应地删除kubernetes。此时我不知道kubernets autoscaler的用途是什么。

http://blog.kubernetes.io/2016/07/autoscaling-in-kubernetes.htmlrel =nofollow> Kubernetes 1.3自动缩放我现在可以让Kubernetes自动缩放我的集群和我的豆荚。



使用 GCP的创建命令现在我可以使用 - enable-autoscaling 结合 - min-nodes - max-nodes - num-nodes


I have a simple wordpress site defined by the ReplicationController and Service below. Once the app is deployed and running happily, I enabled autoscaling on the instance group created by Kubernetes by going to the GCE console and enabling autoscaling with the same settings (max 5, cpu 10).

Autoscaling the instances and the pods seem to work decent enough except that they keep going out of sync with each other. The RC autoscaling removes the pods from the CE instances but nothing happens with the instances so they start failing requests until the LB health check fails and removes them.

Is there a way to make kubernetes scale the pods AS WELL as scale the instaces that they run on so this doesn't happen? Or is there a way to keep them in sync?

My process is as follows:

Create the cluster

$ gcloud container clusters create wordpress -z us-central1-c -m f1-micro

Create the rc

$ kubectl create -f rc.yml

Create the service

$ kubectl create -f service.yml

Autoscale the rc

$ kubectl autoscale rc frontend --max 5 --cpu-percent=10

Then I enabled the autoscaling in the console and gave the servers load to make them scale.

rc.yml

apiVersion: v1
kind: ReplicationController
metadata:
  name: frontend
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: wordpress
    spec:
      containers:
      - image: custom-wordpress-image
        name: wordpress
        ports:
          - containerPort: 80
            hostPort: 80

service.yml

apiVersion: v1
kind: Service
metadata:
  labels:
    name: frontend
  name: frontend
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 80
      protocol: TCP
  selector:
    name: wordpress


Update for more information

If I don't use kubernetes autoscaler and instead set the replicas to the same number as the instance group autoscaler max instance count, I seem to get the desired result. As instances are added to the instance group, kubernetes provisions them, as they are removed kubernetes updates accordingly. At this point I wonder what the purpose of the kubernets autoscaler is for.

解决方案

With the new addition of Kubernetes 1.3 autoscaling I can now have Kubernetes autoscale my cluster and my pods.

Using GCP's create command I can now easily add an autoscaled cluster using the --enable-autoscaling combined with the --min-nodes, --max-nodes, and --num-nodes.

这篇关于Kubernetes pod自动缩放与实例组自动缩放不同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆