Compare GKE and Cloud Run with Artifact Registry images
Push an image to Artifact Registry and choose GKE Autopilot, GKE Standard or Cloud Run by control, identity and operating effort.
By Invicly Tech, , in Google Cloud Engineering and Services. About 9 minutes to read.
In short
Artifact Registry stores your container images privately. GKE runs containers on Kubernetes, and Cloud Run runs them without cluster work. You choose between them by how much control you need, how workloads get identity, and how much operating effort you accept.
Think of it like this: Cloud Run is a taxi: you say where to go. GKE Autopilot is a leased car with Google doing the servicing. GKE Standard is owning the car and the garage.
Explained simply
A container image is a packaged app. Before Google Cloud can run it, the image must live somewhere both your build tools and the runtime can reach. Artifact Registry is that storage. It is private by default, and IAM decides who can pull or push.
Once the image is stored, you pick where to run it. Cloud Run is the simplest: you give it an image and a URL appears. GKE is Google's managed Kubernetes service. It is more flexible, and it comes with more concepts to learn.
GKE has two modes. In Autopilot, Google manages the machines and you describe only your Pods. In Standard, you also manage node pools. Autopilot costs less effort; Standard gives more control.
Pods need an identity to call Google APIs. The safe way is Workload Identity Federation for GKE. A Kubernetes service account is linked to IAM, so no key file is ever stored in the cluster.
Press Play on a diagram to walk through it one step at a time.
- 1Create a Docker repository
Artifact Registry, one region
- 2Configure Docker auth
gcloud auth configure-docker REGION-docker.pkg.dev
- 3Build and tag
REGION-docker.pkg.dev/PROJECT/REPO/IMAGE:TAG
- 4Push
Needs Artifact Registry Writer
- 5Deploy
Cloud Run or GKE pulls with a reader role
- No cluster
- Scales to zero
- Request or job oriented
- Least operating effort
- Kubernetes API, Google manages nodes
- Pay for Pod resource requests
- Some limits on node access
- Good default for Kubernetes
- You manage node pools
- Pay for nodes
- Most control, such as custom hardware
- Most operating effort
- Step 1Image stored in Artifact Registry
- Step 2Needs Kubernetes APIs?
No: choose Cloud Run
- Step 3Needs node-level control?
No: choose Autopilot
- Step 4Otherwise choose Standard
Plan node pools and upgrades
In depth
Repositories, tags and digests
In Artifact Registry you create a repository with a format (Docker here) and a location. The path then looks like us-central1-docker.pkg.dev/PROJECT/REPO/IMAGE:TAG. A tag is a movable label. A digest (sha256:...) is the fixed fingerprint of one exact image. Deploy by digest or by a unique version tag so you know what runs. Grant roles on the repository: Reader to pull, Writer to push. Docker needs credentials, which gcloud auth configure-docker adds for the registry host. Cleanup policies can delete old images to save storage cost.
- Avoid deploying the latest tag.
- Give runtime accounts Reader only.
- Use a regional repository close to where you run.
Autopilot or Standard
Autopilot manages nodes, scaling of nodes, and many security settings. You pay for the CPU, memory and storage your Pods request, so request only what you need. It restricts some node-level access, such as privileged Pods in most cases. Standard lets you choose machine types, run daemons on nodes, use special hardware and tune node pools. You pay for the nodes whether they are full or not, and you handle upgrades planning and capacity. For most teams starting on Kubernetes, Autopilot is the better default. Check current pricing and feature limits in the GKE docs.
- 1Your app and Pod settings
You, in both modes
- 2Node pools and machine types
You in Standard, Google in Autopilot
- 3Node operating system and upgrades
Google, with settings you choose in Standard
- 4Control plane
Google, in both modes
Workload Identity Federation for GKE
Without it, teams once stored service account keys in Kubernetes Secrets, which can leak. With Workload Identity Federation for GKE, the cluster has a workload identity pool. A Pod runs as a Kubernetes service account (KSA). You grant an IAM role directly to the KSA's principal, which looks like principal://iam.googleapis.com/projects/PROJECT_NUMBER/locations/global/workloadIdentityPools/PROJECT_ID.svc.id.goog/subject/ns/NAMESPACE/sa/KSA_NAME. Google client libraries then pick up short-lived tokens automatically. Autopilot clusters have this enabled by default; Standard clusters need it turned on.
Deciding between GKE and Cloud Run
Ask what you need. If you have stateless HTTP services, event handlers or batch jobs, Cloud Run gives scale to zero and almost no cluster work. If you need Kubernetes APIs, custom controllers, many tightly coupled services, sidecars with special networking, or an existing Kubernetes setup, use GKE. If you want Kubernetes but not node work, use Autopilot. A team can run both. Remember the human cost: a cluster needs people who know Kubernetes.
- Small team, simple services: Cloud Run.
- Need Kubernetes features: GKE Autopilot.
- Need node-level control: GKE Standard.
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Create a Docker repository~35m
- 2Push and tag an image~35m
- 3Compare Autopilot and Standard~35m
- 4Use Workload Identity Federation for GKE~35m
- 5Decide between GKE and Cloud Run~35m
Key points
- An image name has the form REGION-docker.pkg.dev/PROJECT/REPOSITORY/IMAGE:TAG.
- Grant pull access with Artifact Registry Reader, push with Writer, on the repository.
- Autopilot manages nodes for you; Standard gives node control and more work.
- Workload Identity Federation for GKE lets Pods call Google APIs without service account keys.
- Choose Cloud Run unless you need Kubernetes features such as custom controllers, many co-located services or special nodes.
Key terms
Tap a card to flip it. 0/5 known
Examples
gcloud artifacts repositories create web --repository-format=docker \
--location=us-central1
gcloud auth configure-docker us-central1-docker.pkg.dev
docker tag demo-app:latest us-central1-docker.pkg.dev/<project-id>/web/demo-app:v1
docker push us-central1-docker.pkg.dev/<project-id>/web/demo-app:v1
gcloud artifacts docker images list us-central1-docker.pkg.dev/<project-id>/webCreate a repository, then tag and push an image. Names are placeholders.
Push an image and let Cloud Run pull it
Create a Docker repository, tag a local image, push it, and deploy from it. The runtime service account needs Artifact Registry Reader. Evidence is the image listed in the repository and a working Cloud Run URL. Cleanup: delete the service and the repository, which stops storage charges.
gcloud artifacts repositories create web --repository-format=docker --location=us-central1
gcloud auth configure-docker us-central1-docker.pkg.dev
docker tag demo-app:latest us-central1-docker.pkg.dev/<project-id>/web/demo-app:v1
docker push us-central1-docker.pkg.dev/<project-id>/web/demo-app:v1
gcloud run deploy demo-app --region=us-central1 --no-allow-unauthenticated \
--image=us-central1-docker.pkg.dev/<project-id>/web/demo-app:v1Give a Pod access to one bucket without keys
On a GKE cluster, create a namespace and a Kubernetes service account, then grant the bucket role to that account's principal. A GKE cluster costs money, so use Autopilot briefly or do this as a design exercise. Evidence is a Pod that lists the bucket with no key file mounted. Rollback: remove the binding and delete the cluster.
kubectl create namespace demo
kubectl create serviceaccount app-ksa --namespace demo
gcloud storage buckets add-iam-policy-binding gs://<bucket-name> \
--role=roles/storage.objectViewer \
--member="principal://iam.googleapis.com/projects/<project-number>/locations/global/workloadIdentityPools/<project-id>.svc.id.goog/subject/ns/demo/sa/app-ksa"Quick reference
- Image path: REGION-docker.pkg.dev/PROJECT/REPO/IMAGE:TAG.
- Create repo: gcloud artifacts repositories create NAME --repository-format=docker --location=REGION.
- Docker auth: gcloud auth configure-docker REGION-docker.pkg.dev.
- Roles: artifactregistry.reader to pull, artifactregistry.writer to push.
- Autopilot: Google manages nodes, you pay for Pod requests.
- Standard: you manage node pools, you pay for nodes.
- Use Workload Identity Federation for GKE, not service account keys.
- Deploy by digest or unique tag, not latest.
Common mistakes
- Using the latest tag in production, so you cannot tell which version runs.
- Putting service account keys in a Pod instead of using Workload Identity Federation.
- Choosing GKE Standard for a small stateless app that Cloud Run would run with far less work.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write the full image name for image demo-app, tag v2, repo web, project example-proj, region europe-west1.
- Exercise 2medium
Let a runtime service account pull images from one repository only.
- Exercise 3hard
A team asks for GKE for five stateless HTTP services and one nightly batch. Make a recommendation.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is Artifact Registry the same as Container Registry?
- No. Artifact Registry replaced Container Registry, which Google has shut down. Use Artifact Registry for new work.
- Can I run the same image on Cloud Run and GKE?
- Yes. It is a standard container image. Cloud Run needs it to listen on the port in the PORT variable.
- Does GKE cost money when idle?
- Yes. There is a cluster management fee after any free credit, and Standard nodes bill while they run. Check current pricing and delete practice clusters.