无法查询指标API

k3bvogb1  于 2022-09-20  发布在  Kubernetes
关注(0)|答案(1)|浏览(149)

我正在学习使用指标服务器一切都很好,我正在使用Docker for Desktop,我安装了指标服务器和“top”命令,但当我尝试使用以下命令查询API时

kubectl get --raw /apis/metrics.k8s.io/v1beta1/nodes/ | jq

我得到

Error from server (NotFound): the server could not find the requested resource

我已经研究这个问题有一段时间了,尝试更改命令,但没有起作用,我得到了相同的错误

我以为问题出在安装上,但当我运行时,我认为一切都配置正确

kubectl describe apiservice v1beta1.metrics.k8s.io

我得到了

Name:         v1beta1.metrics.k8s.io
Namespace:
Labels:       k8s-app=metrics-server
Annotations:  <none>
API Version:  apiregistration.k8s.io/v1
Kind:         APIService
Metadata:
  Creation Timestamp:  2022-08-08T11:52:17Z
  Managed Fields:
    API Version:  apiregistration.k8s.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        f:conditions:
          .:
          k:{"type":"Available"}:
            .:
            f:lastTransitionTime:
            f:message:
            f:reason:
            f:status:
            f:type:
    Manager:      kube-apiserver
    Operation:    Update
    Subresource:  status
    Time:         2022-08-08T11:52:17Z
    API Version:  apiregistration.k8s.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .:
          f:k8s-app:
      f:spec:
        f:group:
        f:groupPriorityMinimum:
        f:insecureSkipTLSVerify:
        f:service:
          .:
          f:name:
          f:namespace:
          f:port:
        f:version:
        f:versionPriority:
    Manager:      kubectl-create
    Operation:    Update
    Time:         2022-08-08T11:52:17Z
    API Version:  apiregistration.k8s.io/v1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
    Manager:         kubectl-client-side-apply
    Operation:       Update
    Time:            2022-08-09T21:32:11Z
  Resource Version:  2821127
  UID:               43dc8cdb-6e61-4e15-b9d7-e18136da230f
Spec:
  Group:                     metrics.k8s.io
  Group Priority Minimum:    100
  Insecure Skip TLS Verify:  true
  Service:
    Name:            metrics-server
    Namespace:       kube-system
    Port:            443
  Version:           v1beta1
  Version Priority:  100
Status:
  Conditions:
    Last Transition Time:  2022-08-09T13:50:09Z
    Message:               all checks passed
    Reason:                Passed
    Status:                True
    Type:                  Available
Events:                    <none>
szqfcxe2

szqfcxe21#

已解决

我在一台Windows机器上,但我使用bash,因为它对我来说更容易,但出于某种原因,我不能真正理解Windows命令提示符(CMD)上的所有东西都运行得很好

相关问题