Skip to content
Visual explainer 3h to learn 5 steps

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.

Topic 12 of 32

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.

FlowFrom code to a stored image
  1. 1
    Create a Docker repository

    Artifact Registry, one region

  2. 2
    Configure Docker auth

    gcloud auth configure-docker REGION-docker.pkg.dev

  3. 3
    Build and tag

    REGION-docker.pkg.dev/PROJECT/REPO/IMAGE:TAG

  4. 4
    Push

    Needs Artifact Registry Writer

  5. 5
    Deploy

    Cloud Run or GKE pulls with a reader role

CompareWhere to run the container
Cloud Run
  • No cluster
  • Scales to zero
  • Request or job oriented
  • Least operating effort
GKE Autopilot
  • Kubernetes API, Google manages nodes
  • Pay for Pod resource requests
  • Some limits on node access
  • Good default for Kubernetes
GKE Standard
  • You manage node pools
  • Pay for nodes
  • Most control, such as custom hardware
  • Most operating effort
FlowDecision path for where to run a container
  1. Step 1
    Image stored in Artifact Registry
  2. Step 2
    Needs Kubernetes APIs?

    No: choose Cloud Run

  3. Step 3
    Needs node-level control?

    No: choose Autopilot

  4. Step 4
    Otherwise 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.

LayersWho looks after what in each mode
  1. 1
    Your app and Pod settings

    You, in both modes

  2. 2
    Node pools and machine types

    You in Standard, Google in Autopilot

  3. 3
    Node operating system and upgrades

    Google, with settings you choose in Standard

  4. 4
    Control 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.

  1. 1
    Create a Docker repository~35m
  2. 2
    Push and tag an image~35m
  3. 3
    Compare Autopilot and Standard~35m
  4. 4
    Use Workload Identity Federation for GKE~35m
  5. 5
    Decide 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

bash
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>/web

Create 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.

bash
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:v1

Give 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.

bash
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.

Question 1

1What is the shape of an Artifact Registry Docker image path?

Question 2

2Which mode bills you for the Pod resources you request rather than for whole nodes?

Question 3

3How should a Pod call Cloud Storage safely?

Question 4

4A stateless HTTP API for a small team has no special needs. Best fit?

Question 5

5Why avoid the latest tag in production?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Write the full image name for image demo-app, tag v2, repo web, project example-proj, region europe-west1.

  2. Exercise 2medium

    Let a runtime service account pull images from one repository only.

  3. 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.

Go deeper

ShareXLinkedInWhatsApp