Skip to content

Error "unable to retrieve the complete list of server APIs: metrics.k8s.io" when any K8s resource is being created by operator through ansible K8s module. #5596

Closed

Description

@subrnath

Type of question

Question

What did you do?

We are trying to deploy a CNF in K8s cluster 1.23.1 with ansible operator from quay.io and following error is coming. This is seen when the metrics-server is installed. If metrics-server is deleted, this error is not seen and all the K8s resources are created fine by the Operator.

{"level":"error","ts":1646985248.079765,"logger":"proxy","msg":"Unable to determine if virtual resource","gvk":"/v1, Kind=Service","error":"unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: an error on the server ("Internal Server Error: \"/apis/metrics.k8s.io/v1beta1?timeout=32s\": the server could not find the requested resource") has prevented the request from succeeding","stacktrace":"github.com/operator-framework/operator-sdk/internal/ansible/proxy.(*cacheResponseHandler).ServeHTTP\n\t/workspace/internal/ansible/proxy/cache_response.go:97\nnet/http.serverHandler.ServeHTTP\n\t/usr/local/go/src/net/http/server.go:2879\nnet/http.(*conn).serve\n\t/usr/local/go/src/net/http/server.go:1930"}

Note 1: This issue is not seen in the previous version of K8s. Issue is coming after upgrade to K8s 1.23.

Note: In the role used by the operator, metrics.k8s.io is added.

  • apiGroups:
    • metrics.k8s.io
      resources:
    • '*'
      verbs:
    • '*'

What did you expect to see?

No error when a k8s resource is created by operator through ansible k8s module.

  • name: Create Headless services
    tags: deploy
    k8s:
    state: present
    definition: "{{ lookup('template', 'app_services.j2') | from_yaml }}"
    namespace: "{{ ansible_operator_meta.namespace }}"

What did you see instead? Under which circumstances?

any ansible task used by the operator through the ansible K8s module, throwing the error.

Issue is seen only when metrics-server is installed in K8s 1.23. If metrics-server is deleted, this issue is not seen.

Environment

Operator type: Ansible

language ansible. We are using the Operator image from https://quay.io/repository/operator-framework/ansible-operator version 1.18. ansible version 2.9.26.

Kubernetes cluster type:

vanilla

$ operator-sdk version

NA

$ go version (if language is Go)

NA

$ kubectl version

1.23.1

Additional context

No issue if the K8s version is < 1.23.

Activity

  1. jmrodri commented on Mar 14, 2022

    @jmrodri
    Member
  2. jmrodri commented on Mar 14, 2022

    @jmrodri
    Member

    Related kube issue: kubernetes/kubernetes#108657

  3. jmrodri commented on Mar 14, 2022

    @jmrodri
    Member

    I've assigned @theishshah and @asmacdo as they are looking at the downstream related downstream bug.

  4. added
    language/ansible
    on Mar 21, 2022
  5. added this to the v1.19.0 milestone on Mar 21, 2022
  6. subrnath commented on Mar 29, 2022

    @subrnath
    Author

    After upgrading the metric-server image to latest 0.6, problem is fixed.

    As per https://github.com/kubernetes-sigs/metrics-server

    0.6.x metrics.k8s.io/v1beta1 1.19+
    0.5.x metrics.k8s.io/v1beta1 *1.8+
    0.4.x metrics.k8s.io/v1beta1 *1.8+
    0.3.x metrics.k8s.io/v1beta1 1.8-1.21

    We were using the image 0.3 which was not compatible with K8s 1.23.

  7. gabe-l-hart commented on Dec 15, 2022

    @gabe-l-hart

    We're seeing this issue crop up in a customer cluster that we don't have full authority over, so a client-side fix in the ansible-operator would be a great improvement. I'll look at emulating the helm fix for the ansible-operator. My first guess on where to fix this is here in proxy.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

language/ansible

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions