docs
uk8s
Cluster Management
Manage Cluster via Kubectl
Common Issues of Kubectl

Common Issues of Kubectl

Error report of kubectl top command

There are generally two possibilities for this situation:

  1. The metrics-server Pod under kube-system is not working properly, which can be checked by kubectl get pods -n kube-system
  2. The metrics.k8s.io API address was redirected erroneously. You can execute kubectl get apiservice v1beta1.metrics.k8s.io to view the service name redirected to, and confirm whether the service is currently available and whether it has exposed the v1beta1.metrics.k8s.io interface. The default redirected address is kube-system/metrics-server

The second situation usually occurs when prometheus is deployed and the interface provided by prometheus does not support v1beta1.metrics.k8s.io. If there's no need to customize HPA indicators, this redirect operation is not necessary. If it's the second case, you can follow the steps below.

  1. Confirm that the prometheus service in the configuration is available, and customize HPA indicators as needed [Customize HPA Indicators](/docs/uk8s/autoscaling/autoscale_on_custom_metrics#Enable custommetricsk8sio service)
  2. Redeploy and execute the following yaml file to rollback to the general metrics server, Grafana, etc do not depend on this api.
  3. Note that if you have used custom HPA indicators before and are in an online environment, it is recommended that you only confirm that prometheus service is available. Rolling back to the general metrics server may cause your previous custom HPA indicators to fail, please operate carefully.
apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService
metadata:
  name: v1beta1.metrics.k8s.io
spec:
  service:
    name: metrics-server
    namespace: kube-system
  group: metrics.k8s.io
  version: v1beta1
  insecureSkipTLSVerify: true
  groupPriorityMinimum: 100
  versionPriority: 100
  • Company
  • ContactUs
  • Blog
Copyright © 2024 SurferCloud All Rights Reserved