Single region GKE cluster and workload

Create a cost-efficient Google Kubernetes Engine (GKE) cluster and workload optimized for resource management in a single location. This guide describes the following templates, which you can use to deploy a basic web application:

  • Single region GKE cluster template: create the foundational infrastructure required for a single region application. This template sets up a secure, private GKE cluster optimized for resource management.

  • Single region GKE workload( Preview ): deploy a helm chart that includes the configuration for a basic web application. The workload is configured to scale based on CPU load, and ensure application availability during voluntary disruptions.

For example, you might deploy the cluster and workload templates to address the following business needs:

Example Business need Implementation
Internal line-of-business application
An internal application requires strict data residency in a specific region, cost-effectiveness for predictable internal usage, and high reliability. Use the single region deployment to ensure data locality. Use autoscaling to efficiently manage resources for internal user demand.
Regional ecommerce backend
An ecommerce platform needs high availability in a specific region to ensure continuous service, scalability to handle traffic spikes during sales events, and robust security for customer transactions and data. Create a multi-zonal cluster configuration provides regional high availability. Use the secure boot configuration to bolster the security posture for sensitive customer data.
Regional data processing and analytics platform
A platform for processing and analyzing large datasets requires data locality for compliance and performance, cost-optimized compute for intermittent batch jobs, and secure access to data. The single-region deployment ensures data remains within geographical boundaries. Scale resources for large processing tasks and idle periods.

Architecture

The following image shows the components and connections in the template:

A cluster connected to a node pool in the design canvas

The following describes the component configurations in this template:

  • GKE Standard cluster : a cost-effective single-region cluster where your workload runs.

    The following table describes the cluster configuration in this template:

    Configuration Purpose
    location is set to us-central1 . Confines cluster resources to a single geographical area, ensuring data locality and minimizing cross-region data transfer costs and latency.
    initial_node_count is set to 1 . Defines an initila node to create in the cluster's default node pool when the cluster is first provisioned. In regional clusters, this is the number of nodes per zone.
    release_channel is set to {"channel":"REGULAR"} . Ensures that your GKE cluster receives stable and predictable updates, providing a balance between new features and reliability.
    enable_intranode_visibility is set to true . Enables visibility for intranode traffic in VPC Flow Logs, which is required for network monitoring, troubleshooting, and security analysis.
    control_plane_endpoints_config is set to {"dns_endpoint_config":{"allow_external_traffic":true}} . The GKE control plane is configured to be publicly accessible to let you manage the cluster outside your Virtual Private Cloud (VPC) network.
  • GKE node pool : a group of worker nodes that run the application's containers.

    The following table describes the node pool configurations in this template:

    Configuration Purpose
    location is set to us-central1 . Specifies the region where this node pool is created. Similar to the cluster's location, this ensures the node pool resources are in a single geographical area.
    autoscaling is set to {"max_node_count":3, "min_node_count":1} . Configures the cluster autoscaler for this node pool. Ensures that the node pool always maintains at least one node, and sets the upper limit to three nodes to control costs and resource consumption.
    node_config is set to {"machine_type":"e2-medium", "oauth_scopes":["https://www.googleapis.com/auth/cloud-platform"], "shielded_instance_config":{"enable_secure_boot":true}} . Groups configurations for the nodes within this pool. The machine type is a balance of CPU and memory suitable for general-purpose workloads. Defines the access granted to the service account. Enables Secure Boot for the Shielded VM instances, helping protect against boot-level malware.

Helm chart configuration

The following table lists the helm chart configurations, which have been customized for deploying and scaling a basic web application on GKE.

Configuration Purpose
replicaCount: 2 Creates two initial replicas to establish an initial level of redundancy.
image.repository: gcr.io/google-samples/hello-app Uses a basic web server Docker image.
resources.requests: {"cpu": "100m", "memory": "128Mi"} Specifies the minimum amount of CPU and memory that are reserved for each pod, ensuring available resources and efficient scheduling.
hpa: {"enabled": true, "minReplicas": 2, "maxReplicas": 10, "targetCPUUtilizationPercentage": 60} Activates the Horizontal Pod Autoscaler to automatically adjust the number of pods between 2 and 10 based on CPU utilization, ensuring performance and cost efficiency.
service: {"type": "ClusterIP", "port": 80} Configures the service for internal access within the cluster on the standard HTTP port.
pdb: {"enabled": true, "minAvailable": 1} Enables a Pod Disruption Budget to ensure that at least one replica remains available during voluntary disruptions, maintaining high availability.

Create your web application

Use the Single region GKE cluster and workload templates to deploy your web application.

Deploy your web infrastructure

Configure and deploy the Single region GKE cluster template to create the foundational infrastructure where your web workload runs.

  1. Duplicate and deploy the Single region GKE cluster template as an application.

    A GKE cluster is created in the deployment project that you choose.

  2. Configure the components. For more information, see the following:

  3. Click Deploy. The application deploys after several minutes.

  4. In the Application detailspanel, click the Outputstab.

  5. Identify the cluster_idfor your application. You'll use this information when you deploy your helm chart.

Deploy your web workload

Use the Single region GKE workload template to deploy your web workload into the cluster you created. You'll deploy a helm chart that includes your web workload configuration.

  1. From the Google catalogpage, on the Single region GKE workloadtemplate, click Create new application.

  2. In the Namefield, enter a unique name for your application.

  3. In the GKE Deployment Targetarea, do the following:

    1. From the Project list, select the project where you deployed the GKE cluster from your Single region GKE cluster application.

    2. From the Regionlist, select the region where you deployed the GKE cluster.

    3. From the Clusterslist, select the deployed GKE cluster.

    4. From the Namespacelist, enter the namespace where you deployed your GKE cluster. If you didn't change the name, enter default .

    5. Click Create application.

    The application is created and the configuration files are displayed.

  4. In the Helm chartpanel, do the following:

    1. Review the configuration details .

    2. Optional: customize the configuration to meet your unique needs.

    3. To deploy the helm chart to your cluster, click Deploy.

      For detailed steps, see Deploy applications .

    After several minutes, the helm chart configuration deploys to your GKE cluster.

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: