Intrigued by the art of cloud architecture? Discover how to design, develop, and manage robust, secure, scalable, and dynamic solutions on Google Cloud as you prepare for the Professional Cloud Architect exam!
Google Kubernetes Engine (GKE) provides automated tools to keep applications running well and cost-effectively, even when traffic changes. The main goal is to add or remove resources automatically so performance stays high without wasting money. This is done using three key autoscalers that work together: the Horizontal Pod Autoscaler (HPA), the Vertical Pod Autoscaler (VPA), and the Cluster Autoscaler.
The Horizontal Pod Autoscaler (HPA) changes the number of identical Pod copies, called replicas, based on current demand. It watches metrics like CPU and memory usage. If traffic spikes, HPA creates more Pods to share the load; when traffic drops, it removes extra Pods. This requires a working Metrics Server to supply the data for these decisions.
The Vertical Pod Autoscaler (VPA) adjusts the amount of CPU and memory assigned to individual Pods. Instead of changing the number of Pods, it "right-sizes" them by looking at their past usage. This prevents a Pod from crashing due to too little memory and stops you from paying for resources a Pod never uses, which is common for workloads where task size varies.
When there is no room left on the existing servers (nodes) to schedule new Pods, the Cluster Autoscaler adds new nodes to the cluster. It watches for Pods that cannot be placed and expands the node pool only when necessary. It can also remove nodes that are underused, which saves money during quiet periods. For high availability, production workloads should use regional clusters, which spread nodes across multiple zones. Tools like GKE usage metering help identify spending patterns for ongoing cost optimization.
GKE offers two primary management modes: Autopilot and Standard. Autopilot is a fully managed service where Google operates the underlying infrastructure, including nodes and scaling. You are billed only for the resources your Pods request. Standard mode gives you more control, as you manage the node virtual machines yourself, but you pay for the entire node regardless of usage. The choice depends on your need for control versus your desire to reduce operational work.
Autopilot simplifies security and management, as Google handles node configuration, security patches, and scaling. It is often the best choice for production because it removes the complex task of bin-packing (fitting Pods efficiently onto nodes to save costs). Standard mode is better if you need specific node operating systems, custom node pools, or specialized hardware like GPUs, but it requires more effort to monitor and optimize to avoid waste.
You must also choose a cluster's layout: regional or zonal. A regional cluster spreads its control plane and node pools across multiple zones within a region, providing higher availability if one zone fails. A zonal cluster keeps all resources in a single zone, which is simpler but less resilient. For production, regional clusters are strongly recommended.
Within a cluster, you organize nodes into node pools. A multi-zonal node pool automatically places nodes in different zones for fault tolerance. A single-zone node pool keeps all nodes in one zone, which can be useful if your application is sensitive to the small network delays between zones. For most production workloads, multi-zonal pools are the default choice.
Tools like the Recommender can analyze your cluster's efficiency. For example, it might suggest migrating a Standard cluster to Autopilot if the nodes are underutilized, indicated by a low CPU bin-packing score. Evaluating these trade-offs between control, availability, and cost ensures your infrastructure is both reliable and cost-effective.
In GKE, security is a shared responsibility. Google secures the infrastructure and control plane, while you secure your workloads, data, and configuration. A strong security posture involves regular node updates and following security best practices.
Access is controlled using both Google Cloud Identity and Access Management (IAM) for project-level permissions and Kubernetes Role-Based Access Control (RBAC) for fine-grained control inside the cluster. A key feature is Workload Identity, which allows Pods to securely access Google Cloud services (like storage or databases) without needing to manage and store static secret keys, enhancing security.
Managing how traffic enters the cluster is done with Ingress controllers and load balancers. They handle tasks like SSL/TLS termination and can integrate with Cloud Armor for protection against attacks. For securing communication between services inside the cluster, Cloud Service Mesh can enforce Mutual TLS (mTLS), ensuring all service-to-service traffic is encrypted and authenticated.
To control traffic flow between Pods, you use Network Policies, which act as a firewall defining which Pods can talk to each other. For an extra layer of security, GKE Sandbox provides kernel-level isolation for containers, preventing a compromised container from affecting the host node or other workloads. This is crucial for running untrusted code or achieving strong multi-tenancy.
Maintaining security requires continuous oversight. Binary Authorization enforces that only trusted and verified container images can be deployed to your cluster. Integrating Cloud Audit Logs and vulnerability scanning tools provides visibility into API activity and identifies security flaws in container images before they are run, helping to detect risks and enforce compliance.
Prepare and test your skills
Prepare and test your skills
The Horizontal Pod Autoscaler (HPA) changes the number of Pod replicas based on current demand, while the Vertical Pod Autoscaler (VPA) adjusts the CPU and memory assigned to individual Pods by right-sizing them based on past usage.
You should use Autopilot mode if you want a fully managed service where Google operates the infrastructure, including nodes and scaling, and you are billed only for Pod resources requested, as it simplifies security and bin-packing. Standard mode is better if you need specific node operating systems, custom node pools, or specialized hardware like GPUs.
A regional cluster spreads its control plane and node pools across multiple zones within a region for higher availability if one zone fails, while a zonal cluster keeps all resources in a single zone, which is simpler but less resilient. For production, regional clusters are strongly recommended.
Workload Identity allows Pods to securely access Google Cloud services like storage or databases without needing to manage and store static secret keys, which enhances security by eliminating the risk of exposed credentials.
Deploy a regional GKE Autopilot cluster
Deploy a regional GKE Standard cluster with manual node pool management
Deploy a zonal GKE Autopilot cluster with automatic node upgrades
Deploy a zonal GKE Standard cluster with Cluster Autoscaler enabled
An enterprise is planning to migrate a fleet of standard web services and background processing microservices to Google Kubernetes Engine (GKE).
The platform architecture must satisfy the following technical and operational criteria:
Which GKE cluster configuration should you recommend?