Skip to content

Bug: In some released go-zero version, RPC service discovery failed in a k8s environment #5617

Description

@weizhengde

Describe the bug
Rpc service discovery is succussful in go-zero version 1.8.3, 1.9.3, but failed in version 1.9.0, 1.10.1. I didn't try all go-zero versions, but the varying behaviors across different versions are confusing, and there is no documentation explaining exactly how to perform service discovery for RPC services in a k8s environment.

To Reproduce
Steps to reproduce the behavior, if applicable:

  1. The code is

    import (
         "github.com/zeromicro/go-zero/zrpc"
     )
    
    c := zrpc.RpcClientConf{
         NonBlock: true,
         Target: "k8s://dev/demo-rpc:8080",
    }

    dev is k8s namespace, demo-rpc is service name, 8080 is service port.

  2. The error is

    rpc dial: k8s://dev/demo-rpc:8080, error: failed to exit idle mode: failed to start resolver:  endpointslices.discovery.k8s.io is forbidden: User "system:serviceaccount:dev:endpoints-reader" cannot list resource "endpointslices" in API group "discovery.k8s.io" in the namespace "dev", make sure rpc service "k8s://dev/demo-rpc:8080" is already started
    

Expected behavior

  1. In all subsequent versions, this configuration syntax is supported.
  2. Improve the documentation to clearly explain how to perform RPC service discovery in a k8s environment.

Environments (please complete the following information):

  • OS: Linux
  • go-zero version 1.10.1
  • goctl version 1.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions