开发者社区> 问答> 正文

获得Exec失败:在k8s上提交spark时的HTTP 403

spark版本:v2.4.0

eks info:v1.10.11-eks

提交后,出现错误信息如下:

019-02-21 15:08:44 WARN WatchConnectionManager:185 - 执行失败:HTTP 403,状态:403 - 禁止使用pod:用户“system:anonymous”无法查看名称空间中的pod“spark”java.net.ProtocolException:预计HTTP 101响应但是'403 Forbidden'

线程“main”中的异常io.fabric8.kubernetes.client.KubernetesClientException:pods被禁止:用户“system:anonymous”无法在命名空间“spark”中观看pod

展开
收起
k8s小能手 2019-02-22 15:52:07 3420 0
1 条回答
写回答
取消 提交回答
  • 整合最优质的专家资源和技术资料,问答解疑

    您需要为系统创建角色:匿名用户在您的命名空间中观察pod,类似于下面的yaml

    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    namespace: spark # your namespace
    name: pod-reader # Role name will be needed for binding to user
    rules:

    • apiGroups: [""] # "" indicates the core API group
      resources: ["pods"]

    verbs: ["get", "watch", "list"]
    然后,您需要创建RoleBindging以将此角色绑定到系统:匿名用户与yaml类似

    This role binding allows "system:anonymous" to read pods in the "spark" namespace.

    kind: RoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: read-pods
    namespace: spark # your namespace
    subjects:

    • kind: User
      name: system:anonymous # Name is case sensitive

    apiGroup: rbac.authorization.k8s.io
    roleRef:
    kind: Role #this must be Role or ClusterRole
    name: pod-reader # this must match the name of the Role or ClusterRole you wish to bind to
    apiGroup: rbac.authorization.k8s.io

    2019-07-17 23:29:10
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spark Streaming At Bing Scale 立即下载
阿里巴巴HTTP 2.0实践及无线通信协议的演进之路 立即下载
CDN助力企业网站进入HTTPS时代 立即下载

相关镜像