我正在尝试通过分别运行这两个命令来自动扩展部署和状态集:
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
有没有人有任何建议?