Why can I not see the images from the Container Registry? - google-cloud-platform

I have created a docker image and uplaoded it to Container Registry.
But when I try to access the image by clicking "Create a Deployment" from my K8s cluster, I get the following error: You don't have permission to list images for this project.
I was looking at this doc and added the following roles: Storage Admin and Storage Object Viewer. Apart from that, I also have the role of an Owner assigned to me.
Can I please seek your guidance on what is it that I am missing here.

I resolved it via enabling the Artifact Registry API. (No need to migrate your existing Container Registry, simply to enable the Artifact Registry API)
I think it is related to the latest Google's recommendation to transitioning to Artifact Registry

Related

Unable to list the Container images in Cloud Run deployment

I have IAM roles like Editor/Cloud Run Admin in my gcp projects (multiple Projects) I am facing this issue,
When I am trying to deploy the container image from Cloud Run's "Edit & Deploy New Revision" screen.
It's not listing the Images in the Project and gives error refer this screenshot for the error message .
Its not only for me other users also facing same issue, but with the same editor and admin roles I am able to list all images in the other project. I have also checked with other developers
If the "Artifact Registry API" is enabled in GCP. then we can list the images from the project.
To enable this API, Search for 'Artifact Registry API' and click enable.
Only if you have this 'Service Usage Admin' IAM role, you can enable API.
Thanks to my Support Team in Project

GCP Vertex AI Service Agent access to GCR image Error

I am getting the below error.
Does anyone have any idea how to solve it?
Failed to create pipeline job. Error: Vertex AI Service Agent
'XXXXX#gcp-sa-aiplatform-cc.iam.gserviceaccount.com' should be granted
access to the image gcr.io/gcp-project-id/application:latest
{PROJECT_NUMBER}#gcp-sa-aiplatform-cc.iam.gserviceaccount.com is google's AI Platform service agent.
This Service agent requires access to read/pull the docker image from your project's gcr to create container for pipeline run.
If You have permission to edit IAM roles, You can try adding Artifact Registry roles to the above service agent.
You can start with adding roles/artifactregistry.reader.
Hope this helps :)
This error may have occurred due to missing roles or permissions for pulling and pushing images into Container Registry. All the users and service accounts must be given appropriate permissions for Cloud Storage who interact with Container Registry. You can give roles/storage.objectViewer, roles/storage.legacyBucketWriter and roles/storage.admin to your service account to access your image in Container Registry using the service-account. You can follow this doc for giving appropriate roles and permissions to the Service Account.

GCP Artifact Registry public google-container images

Since Google is pushing more on Artifact Registry and already announced that Container Registry is not actively developed anymore, is there a replacement for the public Google Container images, that are currently offered at https://console.cloud.google.com/gcr/images/google-containers/GLOBAL ?
Artifact Registry is the evolution of Google Container Registry which basically extends the capabilities of Container Registry. It comes with certain added features over Container Registry like additional Artifact formats, support for both regional and multiregional registry host, support for repository-level permissions, Artifact Registry IAM roles, Google Kubernetes Engine image streaming etc.
However, there is also an option for backwards compatibility and co-existence i.e., you can use both Artifact Registry and Container Registry in the same project. You can explore more on this from the documentation.
Though, Container Registry is still available and supported as a Google Enterprise API, new features will only be available in Artifact Registry and is highly recommended. Container Registry will only receive critical security fixes.
You may also refer to a similar Stackoverflow case.
However, there are other alternatives to Google Container Registry for users who want to try different solutions.
For anyone still looking for answer to this one, Google has official documentation on how to do this via IAM policies
https://cloud.google.com/artifact-registry/docs/access-control#public

Can I limit a service account's authorization to specific images within GCP container registery?

I'd like to have multiple environments setup of my application, and each environment should only have access to push/pull images from a specific image like eu.gcr.io/project-name/abcxyz.
Is this possible? It seems I can only grant a "global" role of Storage Object Creator- but then this gives the service account access to all the images within the project?
You can't directly achieve this. But, thanks to the Artifact registry (new product in Beta ), you have a workaround to achieve this.
Create a new repository of type Docker
Publish your images (and versions of each image) on this repo
Grant the service account that you want on the repo. -> You don't yet have image level authorization, but, as you can create several repos in the same zone, there is no problem for limiting the right like this.

Google Cloud Container: Getting error "does not have edit permissions on project"

I am trying to create a Container Cluster in Google Container Engine using the console (UI).
I am getting the below error while creating a cluster of size - 3 of machine type "n1-standard-1"
"xxxxxxxxxxx#cloudservices.gserviceaccount.com" does not have edit permissions on project "xxxx-xxxxxx-xxxxxx".
I have already enabled the API's related to Container management :-
Google Cloud Container Builder API
Google Container Engine API
Also, I haven't created a service account as given in the error "xxxxxxxxxxx#cloudservices.gserviceaccount.com" . I don't know about this service-account? what is this used for? and who created it?
Though I have another service account, which is different from the one shown in error, it has all the edit permissions to my project.
The xxxxxxxxxxx#cloudservices.gserviceaccount.com is the service account that Google Container Engine uses to create the resources for your cluster. You'll need to make sure that it has "Editor" role in the permissions section of your GCP project.