0
0
GCPcloud~20 mins

Deploying container images in GCP - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Container Deployment Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
service_behavior
intermediate
2:00remaining
Understanding container image deployment behavior on Google Cloud Run

You deploy a container image to Google Cloud Run with the default settings. What happens when the container crashes repeatedly during startup?

ACloud Run sends an alert email to the project owner and pauses the service.
BCloud Run automatically retries starting the container several times before marking the service as unavailable.
CCloud Run scales up additional container instances to compensate for the crash.
DCloud Run immediately stops trying and marks the service as failed without retries.
Attempts:
2 left
💡 Hint

Think about how Cloud Run handles transient failures to keep services available.

Configuration
intermediate
2:00remaining
Configuring environment variables for a container deployed on Google Kubernetes Engine (GKE)

You want to deploy a container on GKE and pass environment variables to it. Which YAML snippet correctly sets environment variables in the container spec?

GCP
apiVersion: v1
kind: Pod
metadata:
  name: env-test
spec:
  containers:
  - name: test-container
    image: gcr.io/my-project/my-image
    env:
      - name: VAR1
        value: "value1"
      - name: VAR2
        value: "value2"
A
env_vars:
  - VAR1=value1
  - VAR2=value2
B
environment:
  VAR1: value1
  VAR2: value2
C
env:
  - name: VAR1
    value: "value1"
  - name: VAR2
    value: "value2"
D
variables:
  - name: VAR1
    value: value1
  - name: VAR2
    value: value2
Attempts:
2 left
💡 Hint

Look for the correct Kubernetes container environment variable syntax.

Architecture
advanced
2:00remaining
Designing a scalable container deployment on Google Cloud Run with traffic splitting

You want to deploy a new version of your container image on Cloud Run and gradually shift 30% of traffic to it while keeping 70% on the old version. Which approach achieves this?

ADeploy the new revision and use Cloud Run traffic splitting to route 30% to the new revision and 70% to the old revision.
BDeploy the new revision and update the service to point only to the new revision, then manually redirect 30% of users via DNS.
CDeploy the new revision and delete the old revision to force 30% traffic to the new one.
DDeploy the new revision and create a separate Cloud Run service for it, then use a load balancer to split traffic.
Attempts:
2 left
💡 Hint

Cloud Run supports traffic splitting natively between revisions.

security
advanced
2:00remaining
Securing container image access in Google Container Registry (GCR)

You want to restrict access to your private container images in GCR so only a specific Cloud Run service can pull them. What is the best way to do this?

AGrant the Cloud Run service's service account the 'Storage Object Viewer' role on the GCR bucket.
BMake the GCR bucket public and rely on Cloud Run authentication to restrict access.
CUse a firewall rule to block all IPs except Cloud Run's IP range.
DEmbed the GCR credentials inside the container image for authentication.
Attempts:
2 left
💡 Hint

Think about IAM roles and permissions for accessing GCR images.

Best Practice
expert
2:00remaining
Optimizing container image deployment speed and cost on Google Cloud Build and Cloud Run

You want to minimize deployment time and cost when building and deploying container images to Cloud Run. Which practice is most effective?

ADeploy directly from source code to Cloud Run without building a container image.
BBuild the entire container image from scratch every time to ensure freshness, then deploy.
CPush the container image to Docker Hub instead of Google Container Registry to reduce costs.
DUse Cloud Build caching to reuse layers and build only changed parts, then deploy the image to Cloud Run.
Attempts:
2 left
💡 Hint

Consider how build caching affects build speed and cost.