Kubernetes pod自动缩放与实例组自动缩放不同步 [英] Kubernetes pod autoscaling out of sync with Instance Group autoscaling
问题描述
我有一个简单的wordpress网站,由 ReplicationController
和 Service
定义。一旦应用程序部署并且运行愉快,我可以通过访问GCE控制台并使用相同设置(最大5,cpu 10)启用自动调节来启用由Kubernetes创建的实例组的自动调节。 b
$ b
自动缩放实例和豆荚似乎工作得不错,除非它们彼此保持不同步。 RC自动缩放会从CE实例中移除窗格,但实例不会发生任何反应,因此它们会在LB运行状况检查失败并将其删除之前启动失败请求。
有没有办法为了让Kubernetes缩放这些豆荚,并且缩放它们运行的安装位置,所以这种情况不会发生?或者有什么办法让它们保持同步?
我的过程如下:
创建群集
创建rc 创建服务 自动调整rc 然后我在控制台中启用了自动缩放功能,并给服务器加载以使它们扩展。 rc.yml < service.yml 更新资讯 如果我不使用kubernetes autoscaler,而是将副本设置为与实例组autoscaler max实例数相同的数字,我似乎得到了所需的结果。当实例被添加到实例组中时,kubernetes会对它们进行规定,因为它们会相应地删除kubernetes。此时我不知道kubernets autoscaler的用途是什么。 使用 GCP的创建命令现在我可以使用 I have a simple wordpress site defined by the 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. My process is as follows: Create the cluster Create the rc Create the service Autoscale the rc Then I enabled the autoscaling in the console and gave the servers load to make them scale. rc.yml service.yml
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 这篇关于Kubernetes pod自动缩放与实例组自动缩放不同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! $ gcloud container clusters create wordpress -z us-central1 -c -m f1-micro $ c
$ b
$ kubectl create -f rc.yml
$ kubectl create -f service.yml
$ kubectl autoscale rc frontend --max 5 --cpu-percent = 10
$ p $ apiVersion:v1
类型:ReplicationController
元数据:
名称:frontend
规格:
副本:1
模板:
元数据:
标签:
应用程序:wordpress
规格:
容器:
- image:custom-wordpress-image
name:wordpress
ports:
- containerPort:80 $ b $ hostPort:80
$ b
apiVersion :v1
kind:服务
元数据:
标签:
名称:前端
名称:前端
规格:
类型:LoadBalancer
端口:
- 端口:80
targetPort:80
协议:TCP
选择器:
名称:wordpress
- enable-autoscaling
结合 - min-nodes $ c $轻松添加自动标定群集c>,
- max-nodes
和 - num-nodes
。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). 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?
$ gcloud container clusters create wordpress -z us-central1-c -m f1-micro
$ kubectl create -f rc.yml
$ kubectl create -f service.yml
$ kubectl autoscale rc frontend --max 5 --cpu-percent=10
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
apiVersion: v1
kind: Service
metadata:
labels:
name: frontend
name: frontend
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
name: wordpress
--enable-autoscaling
combined with the --min-nodes
, --max-nodes
, and --num-nodes
.