Reputation: 93
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: busy-autoscaler
spec:
behavior:
scaleDown:
stabilizationWindowSeconds: 10
policies:
- type: Percent
value: 50
periodSeconds: 15
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: busy-worker
minReplicas: 1
maxReplicas: 2
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
error: error validating "hpa.yml": error validating data: ValidationError(HorizontalPodAutoscaler.spec): unknown field "behavior" in io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerSpec; if you choose to ignore these errors, turn validation off with --validate=false
$ kubectl version --short
Client Version: v1.18.0
Server Version: v1.14.9-eks-502bfb
Upvotes: 4
Views: 5123
Reputation: 7023
Firstly ensure that does kubectl api-versions
show autoscaling/v2beta2 enabled.
You might also have a problem with your server version- v1.14.9-eks-502bfb.
See more: metrics-server. Please let me know if it helps.
Upvotes: 0
Reputation: 457
you can check available fields by running:
kubectl explain --api-version=autoscaling/v2beta2 HorizontalPodAutoscaler.spec
Upvotes: 6