Notes
  • Overview
  • Go
    • Basics
    • How To?
    • Tools & Libraries
    • Tutorials
    • Go Modules
    • Design Patterns
    • Guidelines
      • Code Review and Comments
    • Conversion
      • map[string]interface{} to JSON
      • map[string]interface{} to struct
    • Tips & Tricks
  • Docker
    • Blog Posts
    • Commands
  • Kubernetes
    • Courses
    • Concepts
    • Networking
      • Ingress Controller
    • KIND
    • Custom Resources
    • Tips & Tricks
      • Commands
        • Log
        • List
      • Container
        • Inject Executable Script
      • RBAC
        • Cross namespaced access
      • Patching Object
        • Restrict Key
      • Copy Object
  • Git
    • Rebase
  • System Design
    • Pub-Sub
      • Ovserver vs PubSub
  • Distributed System
    • Untitled
  • Linux
    • Bash
      • Basics
      • How To?
      • Pipe
      • Tips & Tricks
  • Security
    • Untitled
  • Database
    • PostgreSQL
      • Tricks & Tips
    • MySQL
      • Tips & Tricks
  • MISC
    • Development Patterns
    • Useful Github Apps/Actions
    • Parameters vs Arguments
    • Open API
  • Terminal
  • VS Code
Powered by GitBook
On this page

Was this helpful?

  1. Kubernetes
  2. Tips & Tricks
  3. RBAC

Cross namespaced access

How to provide namespaced acces to a service account of other namespace?

Problem:

Let, we have two namespaces A and B. We want to provide access of some resources of namespace B to a ServiceAccount of namespace A.

Solution:

Create a RoleBinding in namespace B with subject pointing to ServiceAccount of namespace A.

kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: demo
  namespace: B
subjects:
- kind: ServiceAccount
  name: demo-sa
  namespace: A
roleRef:
  kind: Role
  name: demo-role
  apiGroup: rbac.authorization.k8s.io

PreviousRBACNextPatching Object

Last updated 4 years ago

Was this helpful?