Failed to login: Error making API request - * namespace not authorized

Hi All,

I am just curios about how to fix the below issue.


rpc error: code = Unknown desc = error making mount request: failed to login: Error making API request

URL: POST http://vault:8200/v1/auth/kubernetes/login
Code: 403. Errors:

* namespace not authorized


{"time":"2022-09-21T00:01:16.883372796Z","type":"response","auth":{"policy_results":{"allowed":true},"token_type":"default"},"request":{"id":"38d7bf88-e960-0265-0c44-cfcd12952970","operation":"update","mount_type":"kubernetes","mount_accessor":"auth_kubernetes_7f0ff550","namespace":{"id":"root"},"path":"auth/kubernetes/login","data":{"jwt":"hmac-sha256:ced9d876ac3553a29683205e14efdeeaf39d3f5cc22aedabb8bdc6ba0367c83f","role":"hmac-sha256:4c498acbb2ffecfcad1831e4645e6881fc6e0ebdf607cdaa2c2c8ebd17357bea"},"remote_address":"100.66.15.2","remote_port":51784},"response":{"mount_type":"kubernetes","mount_accessor":"auth_kubernetes_7f0ff550"},"error":"namespace not authorized"}

this is what i noticed in the vault pod logs.

"time":"2022-09-21T00:01:05.047455984Z","type":"response","auth":{"token_type":"default"},"request":{"id":"9c5d1dc0-5a5a-de4a-c953-fa2530a3e1c5","operation":"read","mount_type":"system","client_token":"hmac-sha256:fd5d6763c58cc6fd25e8627f6eab9f5883ae39868a17c7a44172a98a81da2910","namespace":{"id":"root"},"path":"sys/metrics","data":{"format":"hmac-sha256:1854ab3c008eb7390aa9df5433164ed33c651c1017ae59797806d089cebad591"},"remote_address":"100.66.0.97","remote_port":49070},"response":{"mount_type":"system","data":{"error":"hmac-sha256:f0dfffaaf767860fcae8e18086d032a37c4a6d52576d74a0f458751c8a246ebf"}},"error":"1 error occurred:\n\t* permission denied\n\n"}



Is the role you’re authenticating with setup for the Kube namespace this particular pod is in?