问题原文
原帖链接 · claudiu.decean · CC BY-SA 4.0
While following the tutorial found here I saw that I need autoscaling/v2beta2 for having custom metrics for the Horizontal Pod Autoscaler, but don't know how to enable it.
Environment details:
- Google Cloud platform
- Kubernetes version 1.13.7-gke.8 (latest)
What did I try:
Using "kubectl api-versions", I checked what API groups I have enable for autoscaling and have only the following: autoscaling/v1 autoscaling/v2beta1
I found the following documentation that says "Certain resources and API groups are enabled by default. They can be enabled or disabled by setting --runtime-config on apiserver. --runtime-config accepts comma separated values.". Taking a look at the kube-apiserver command documentation , I could find a way to use this command for gcloud
已采纳解答
原帖链接 · Harsh Manvar · CC BY-SA 4.0
if you are on GKE and facing issue where enabled API are
autoscaling/v1
autoscaling/v2beta1
while GKE version is around 1.12 to 1.14 you wont be able to apply manifest of autoscaling/v2beta2 however you can apply same thing something like
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: core-deployment
namespace: default
spec:
maxReplicas: 9
minReplicas: 5
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: core-deployment
metrics:
- type: Resource
resource:
name: cpu
targetAverageValue: 500m
if you want based on utilization
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: core-deployment
namespace: default
spec:
maxReplicas: 9
minReplicas: 5
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: core-deployment
metrics:
- type: Resource
resource:
name: cpu
targetAverageUtilization: 80
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
