<p>I am trying to access all the namespaces and pods from my another pod. So, I have created clusterrole, clusterrolebinding and service account. I am able access the only customer namespace resources. But I need to access all the namespace resources. Is it possible?</p>
<pre><code>apiVersion: v1
kind: ServiceAccount
metadata:
  name: spinupcontainers
  namespace: customer

---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: spinupcontainers
  namespace: customer
rules:
  - apiGroups: [&quot;&quot;]
    resources: [&quot;pods&quot;, &quot;pods/exec&quot;]
    verbs: [&quot;get&quot;, &quot;list&quot;, &quot;delete&quot;, &quot;patch&quot;, &quot;create&quot;]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: spinupcontainers
  namespace: customer
subjects:
  - kind: ServiceAccount
    name: spinupcontainers
roleRef:
  kind: ClusterRole
  name: spinupcontainers
  apiGroup: rbac.authorization.k8s.io
</code></pre>
<p>Could anyone help to resolve this problem?</p>
<p>Thanks in advance</p>

az rnd
<p>It seems in your YAML example you are using a <code>RoleBinding</code> as opposed to a <code>ClusterRoleBinding</code>. A <code>RoleBinding</code> only grants those permissions inside of a namespace. See also the <a href="https://kubernetes.io/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding" rel="noreferrer">Kubernetes Documentation on this topic</a>:</p>
<blockquote>
<p>A RoleBinding grants permissions within a specific namespace whereas a
ClusterRoleBinding grants that access cluster-wide.</p>
</blockquote>
