Vin*_*y B 7 scalability autoscaling kubernetes kubernetes-pod
我正在尝试使用自动缩放方案(目前使用 microk8s 单节点个人集群)。
基本的 CPU 缩放工作正常。
对于更复杂的场景,我试图按照https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/#autoscaling-on-multiple-metrics-and- 上的指南进行操作custom-metrics但我无法弄清楚如何/在哪里定义/记录可能的 pod 指标/对象指标。例如,.. 记录“每秒数据包数”的位置。
我可以通过 kubectl 进行导航或手动使用 REST API,但必须有更好的方法。
谢谢
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: php-apache
namespace: default
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: php-apache
minReplicas: 1
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageUtilization
averageUtilization: 50
- type: Pods
pods:
metric:
name: packets-per-second ====> where is this name defined/documented ?
targetAverageValue: 1k
- type: Object
object:
metric:
name: requests-per-second ====> where is this name defined/documented ?
describedObject:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
name: main-route
target:
kind: Value
value: 10k
Run Code Online (Sandbox Code Playgroud)
ResourceMetric 中的 CPU 或内存使用情况由 kubelet 提供并由metric-server收集
但是对于packets-per-secondand requests-per-second,没有官方提供者,所以这个字段实际上可以是任何值,取决于你部署的非官方自定义指标 API。
一些流行的自定义指标 API 列在 https://github.com/kubernetes/metrics/blob/master/IMPLEMENTATIONS.md
| 归档时间: |
|
| 查看次数: |
1894 次 |
| 最近记录: |