Professional Cloud Developer
Professional Cloud Developer
Gauge your current knowledge
Gauge your current knowledge
Professional Cloud Developer
Gauge your current knowledge
Gauge your current knowledge
Cloud Run is a fully managed service that runs containers without requiring you to manage servers or infrastructure. When you deploy an application to Cloud Run, you package your code and its dependencies into a container image, then upload that image to Cloud Run. The service automatically scales the number of container instances based on incoming traffic, adding more instances when requests increase and removing them when traffic drops to zero if you configure it to do so.
Traffic flows from users directly to your Cloud Run service, which handles the routing. Cloud Run manages the entire lifecycle of each container instance: it creates the container when traffic arrives, keeps it running while requests come in, and stops it when idle. You only pay for the compute time your containers actually use, which makes it cost-effective for applications with variable or unpredictable traffic patterns.
To deploy to Cloud Run, you need a container image stored in a registry such as Artifact Registry or Container Registry. The deployment process involves specifying the container image, setting environment variables, configuring memory limits, and defining how the service should scale. Cloud Run integrates with other GCP services, so your application can connect to databases, secret manager, or other cloud resources using IAM permissions attached to the service's runtime service account.
GKE stands for Google Kubernetes Engine, and it provides a managed Kubernetes cluster where you run containerized applications. Unlike Cloud Run, GKE gives you more control over the underlying infrastructure, including the ability to define node pools, configure custom machine types, and access Kubernetes features directly. This makes GKE suitable for applications that require fine-grained orchestration, complex networking, or custom cluster configurations.
In GKE, you deploy containers by creating Kubernetes resources such as Deployments, Services, and Ingress. A Deployment defines how many replicas of your application should run and manages updates by gradually replacing old pods with new ones. A Service exposes your application within the cluster, while an Ingress handles external traffic routing. GKE automatically manages the control plane, but you are responsible for the worker nodes where your containers run.
GKE supports auto-scaling at multiple levels: the cluster can add or remove nodes based on resource needs, and Kubernetes itself can scale the number of pod replicas based on CPU usage or other metrics. The cluster can operate in different modes, including Autopilot where Google manages the infrastructure for you, and Standard mode where you have more control over node configuration. Security in GKE involves configuring Workload Identity for secure service-to-service communication, Network Policies to control pod-to-pod traffic, and RBAC rules to manage access to cluster resources.