【发布时间】:2023-04-10 18:48:02
【问题描述】:
我正在尝试通过分别运行以下两个命令来自动扩展部署和状态集:
kubectl autoscale statefulset mysql --cpu-percent=50 --min=1 --max=10
kubectl expose deployment frontend --type=LoadBalancer --name=frontend
遗憾的是,在 minikube 仪表板上,两个服务下都出现了这个错误:
failed to get cpu utilization: unable to get metrics for resource cpu: unable to fetch metrics from resource metrics API: the server could not find the requested resource (get pods.metrics.k8s.io)
在线搜索我读到它可能是一个 dns 错误,所以我检查了但 CoreDNS 似乎运行良好。 两种工作负载都没有什么特别之处,这是“前端”部署:
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
labels:
app: frontend
spec:
replicas: 3
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: hubuser/repo
ports:
- containerPort: 3000
有人有什么建议吗?
【问题讨论】:
标签: kubernetes minikube autoscaling horizontal-pod-autoscaling