I am implementing a PubSub-Pull in GKE but when running, the pod throws this error:
File "main.py", line 35, in <module> streaming_pull_future.result()
File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 444, in result return self.__get_result()
File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result raise self._exception google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes. [reason: "ACCESS_TOKEN_SCOPE_INSUFFICIENT"
After deploying from yaml, I launch these IAM bindings:
Observe that, I before running the above, I made a preliminary step on the GitHub code to create templates. In other words, I introduced variables like PROJECT_ID, KSA, cm_GSA etc in order to make the code easier to understand and to reuse. More in details, using the sed command, I made the following replacements:
The nodepool’s node where the pod is running should have GKE_METADATA enabled.
Does the nodepool have GKE_METADATA enabled?
If you want to use workload-identity, then you will have to enable GKE_METADATA on your nodepools.
If you want to use the SA assigned to the nodepool to authenticate, then you can add the scope pubsub.googleapis.com to the nodepool.
Please tell me if this answer resolved your issue.