• 微服务
  • jaeger-operator一直报错,failed to list *v1.Namespace:....

a759916748a

执行下面这个命令看看,应该是clusterrole 少了 namespaceget/list/watch 权限

kubectl get rolebindings,clusterrolebindings --all-namespaces -o custom-columns='KIND:kind,NAMESPACE:metadata.namespace,NAME:metadata.name,SERVICE_ACCOUNTS:subjects[?(@.kind=="ServiceAccount")].name,ROLE_TYPE:roleRef.kind,ROLE:roleRef.name' | uniq | awk '{if ($4 == "jaeger-operator") print $0}' | awk '{ if ($5 == "Role") {print "kubectl get -oyaml "$5"/"$3" -n"$2} else {print "kubectl get -oyaml "$5"/"$3}}' | sh

    a759916748a 上面那个命令试查看 jaeger-operator 这个 sa 有哪些权限,当然不会有什么作用了。我的意思是让你看看 jaeger-operator 有没有 namespace 这个资源的读取权限,没有的话需要加上。你把命令的输出贴一下

      1 个月 后

      Nrehearsal

      你好,我这边也有这个报错,但是我看了jaeger-operator的role里边有naspaces的get、watch、list的权限,请问还需要如何排查

      zhanglihao

      ok。
      因为namespace是cluster-scope的资源。

      larry@DESKTOP-S1CV2P0:~$ kubectl api-resources
      NAME                               SHORTNAMES   APIVERSION                             NAMESPACED   KIND
      bindings                                        v1                                     true         Binding
      componentstatuses                  cs           v1                                     false        ComponentStatus
      configmaps                         cm           v1                                     true         ConfigMap
      endpoints                          ep           v1                                     true         Endpoints
      events                             ev           v1                                     true         Event
      limitranges                        limits       v1                                     true         LimitRange
      namespaces                         ns           v1                                     false        Namespace

        zhanglihao
        你按照模板更新一下你发的那个issue帖子,尽可能多的提供环境信息。还有论坛里面有很多【日志】相关的帖子,你也搜搜看。

          3 个月 后
          4 天 后
          15 天 后

          试一下自己创建一下clusterrole,如下:
          apiVersion: rbac.authorization.k8s.io/v1

          kind: ClusterRole

          metadata:

          name: jaeger-operator

          rules:

          - apiGroups: [""]

          resources: [“namespaces”]

          verbs: [“get”, “list”, “watch”]

          ---

          apiVersion: rbac.authorization.k8s.io/v1

          kind: ClusterRoleBinding

          metadata:

          name: jaeger-operator

          subjects:

          - kind: ServiceAccount

          name: jaeger-operator

          namespace: istio-system

          roleRef:

          kind: ClusterRole

          name: jaeger-operator

          apiGroup: rbac.authorization.k8s.io

          3 个月 后

          创建个yaml文件 jaeger-operator.yaml

          kind: ClusterRole
          metadata:
            name: jaeger-operator
          rules:
            - apiGroups:
                - ""
              resources:
                - namespaces
              verbs:
                - get
                - list
                - watch
          
          ---
          apiVersion: rbac.authorization.k8s.io/v1
          kind: ClusterRoleBinding
          metadata:
            name: jaeger-operator
          roleRef:
            apiGroup: rbac.authorization.k8s.io
            kind: ClusterRole
            name: jaeger-operator
          subjects:
            - kind: ServiceAccount
              name: jaeger-operator
              namespace: istio-system

          然后导入一下
          kubectl apply -f jaeger-operator.yaml

          6 天 后

          这个报错是上游 jaeger-operator 中的小问题,在后面版本也修复了,ks 中在安装使用时默认关闭了 rbac.clusterRole 配置项,ks 中这种用法也不影响其正常使用。