Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

status code 403 trying to fetch token errors for the cnrm controller #289

Closed
red8888 opened this issue Oct 13, 2020 · 3 comments
Closed
Labels
question Further information is requested

Comments

@red8888
Copy link

red8888 commented Oct 13, 2020

I deployed the config connecter per the docs but In the logs of the cnrm-system pod im seeing these weird errors:

Error while sending request to Stackdriver Post https://monitoring.googleapis.com/v3/projects/myproject/timeSeries?alt=json: status code 403 trying to fetch http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token

Now I confirmed my GSA being used has owner role on myproject. Whats this token error about?

My manifest:

---
apiVersion: core.cnrm.cloud.google.com/v1beta1
kind: ConfigConnector
metadata:
  name: configconnector.core.cnrm.cloud.google.com
---
apiVersion: core.cnrm.cloud.google.com/v1beta1
kind: ConfigConnectorContext
metadata:
  name: configconnectorcontext.core.cnrm.cloud.google.com
  namespace: default
spec:
  # This account has the owner role in the myproject gcp project
  googleServiceAccount: "[email protected]"
@red8888 red8888 added the question Further information is requested label Oct 13, 2020
@maqiuyujoyce
Copy link
Collaborator

Hi @red8888 , thank you for your question. Are you seeing the logs of the "cnrm-controller-manager-XXXX" pod? I assume you meant a pod in the "cnrm-system" namespace? Would be great if you can provide more details. E.g. the steps/commands to find the error logs.

In addition, are you blocked on this error?

@red8888
Copy link
Author

red8888 commented Oct 14, 2020

Yes it appears I cant create resources either I get this error:

Received 403 `Unable to generate access token; IAM returned 403 Forbidden: The caller does not have permission
This error could be caused by a missing IAM policy binding on the target IAM service account.
For more information, refer to the Workload Identity documentation

I followed the doc and confirmed the pods are running and everything and made sure the google service account has the right permissions: https://cloud.google.com/config-connector/docs/how-to/install-upgrade-uninstall

I created the context that links the k8s service account to the google service account like the docs say:

apiVersion: core.cnrm.cloud.google.com/v1beta1
kind: ConfigConnectorContext
metadata:
  # you can only have one ConfigConnectorContext per Namespace
  name: configconnectorcontext.core.cnrm.cloud.google.com
  namespace: [NAMESPACE]
spec:
  # The Google Service Account used to authenticate Google Cloud APIs in this Namespace
  googleServiceAccount: "[NAMESPACE_GSA]@[HOST_PROJECT_ID].iam.gserviceaccount.com"

I see the stackdriver errors and the errors when trying to create resources in the cnrm-controller-manager-xxx Stateful Sets pods

@red8888
Copy link
Author

red8888 commented Oct 14, 2020

my bad I had the wrong syntax for the IAM to k8s service account binding. This seems to be working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants