简体   繁体   中英

Use GCP debugger but got permission error

I add @google-cloud/debug-agent on my nodejs project which is deployed on GKE.
But I got error:

restify listening to http://[::]:80
@google-cloud/debug-agent Failed to re-register debuggee nodejs-bot: Error: The caller does not have permission
@google-cloud/debug-agent Failed to re-register debuggee nodejs-bot: Error: The caller does not have permission
@google-cloud/debug-agent Failed to re-register debuggee nodejs-bot: Error: The caller does not have permission
@google-cloud/debug-agent Failed to re-register debuggee nodejs-bot: Error: The caller does not have permission

I have checked my GKE have the debug permission. I don't know why the service didn't have permission.

在此处输入图片说明

Here is the code I define on my index.ts

import * as tracer from '@google-cloud/trace-agent';
tracer.start();
import * as debug from '@google-cloud/debug-agent';
debug.start();

This issue can be resolved by doing the following:

1 - Create a new Cluster with these permissions enabled (ie Cloud Debugger/ Cloud Platform 'Enabled') and with the required scopes. [1]

Example:

$ gcloud container clusters create example-cluster-name --scopes https://www.googleapis.com/auth/cloud_debugger --zone

2- You can use the same YAML config files you used to deploy your original workloads in the new cluster. You must make sure you have the required scopes for this to work.

You can review how authentication and scopes work using [2] [3] .

I found the issue is caused by workload identity, so I just close this feature to fix this issue.

Because I select to launch the workload identity feature. Every pod which needs to connect GCP service will need to create a service account for these pods. Otherwise, the permission will be blocked.

https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM