Solve the problem of Metrics - Server

Error from server (NotFound): the server could not find the requested resource (get services http:heapster:)

  • A large part of this is due to the removal of the Apiservice Resources from Metics, when you execute the following command to ensure that the Apiservice exists kubectl get apiservice | grep metrics

v1beta1.metrics.k8s.io kube-system/metrics-server True 4d6h

  • Check to see if you can find the correct Apiservice and register the correct Service name below Namespace. If not, you can simply create an Apiservice YAML file that points to the correct Metrics- Server Service
 1apiVersion: apiregistration.k8s.io/v1
 2kind: APIService
 3metadata:
 4  labels:
 5    k8s-app: metrics-server
 6  name: v1beta1.metrics.k8s.io
 7spec:
 8  group: metrics.k8s.io
 9  groupPriorityMinimum: 100
10  insecureSkipTLSVerify: true
11  service:
12    name: metrics-server # Replace correct metrics-server's service name in namespace
13    namespace: kube-system
14  version: v1beta1
15  versionPriority: 100
  • Rerequest the resource and execute the following command kubectl apply -f metrics-apiservice.yaml