Enable Regional Redundancy For Maximum Availability
More Info:
GKE cluster should be regional for maximum availability of control plane during upgrades and zonal outages
Risk Level
High
Address
Operational Excellence, Performance Efficiency, Reliability, Security
Compliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Using Console
To enable regional redundancy for maximum availability in GCP, follow these step-by-step instructions:
-
Open the GCP Console and select the project where you want to enable regional redundancy.
-
Go to the Cloud Storage section of the console.
-
Select the bucket for which you want to enable regional redundancy.
-
Click on the "Edit bucket" button at the top of the page.
-
Scroll down to the "Location" section of the page.
-
Select "Regional" from the dropdown menu.
-
Choose the region where you want to store your data.
-
Click on the "Save" button at the bottom of the page.
-
Wait for the changes to take effect. This may take some time depending on the amount of data you have stored in your bucket.
Once you have completed these steps, your bucket will be configured for regional redundancy, which means that your data will be stored in multiple locations within the same region for maximum availability.
Using CLI
To enable regional redundancy for maximum availability in GCP, follow these steps using GCP CLI:
-
Open the Google Cloud Console and select the project that contains the resources you want to configure.
-
Open the Cloud Shell by clicking on the "Activate Cloud Shell" button on the top right corner of the console.
-
Run the following command to enable regional redundancy for Cloud Storage:
gsutil versioning set on gs://[BUCKET_NAME]Replace [BUCKET_NAME] with the name of the bucket you want to enable regional redundancy for.
-
Run the following command to enable regional redundancy for Cloud SQL:
gcloud sql instances patch [INSTANCE_NAME] --availability-type REGIONALReplace [INSTANCE_NAME] with the name of the Cloud SQL instance you want to enable regional redundancy for.
-
Run the following command to enable regional redundancy for Compute Engine:
gcloud compute instances create [INSTANCE_NAME] --zone [ZONE] --create-disk=auto-delete=yes,boot=yes,mode=rw,name=[DISK_NAME],replica-zones=[ZONE_1],[ZONE_2],type=pd-ssdReplace [INSTANCE_NAME] with the name of the Compute Engine instance you want to enable regional redundancy for. Replace [ZONE] with the primary zone for the instance. Replace [DISK_NAME] with the name of the boot disk for the instance. Replace [ZONE_1] and [ZONE_2] with the two additional zones you want to replicate the instance to.
By following these steps, you can enable regional redundancy for maximum availability in GCP.
Using Python
To enable regional redundancy for maximum availability in GCP using Python, you can follow these steps:
- Import the necessary libraries:
from google.cloud import storage
- Create a client object for the storage bucket:
client = storage.Client()
- Get the bucket object:
bucket = client.get_bucket('your-bucket-name')
- Set the location type to regional:
bucket.location_type = 'regional'
- Set the location to the desired region:
bucket.location = 'your-region'
- Update the bucket:
bucket.update()
- Confirm that the bucket is now using regional redundancy by checking the bucket's location type:
print(bucket.location_type)
This should output "REGIONAL", indicating that the bucket is now using regional redundancy.
Note: Replace "your-bucket-name" and "your-region" with the actual name of your bucket and the desired region, respectively.
Using Terraform
resource "google_container_cluster" "PRIMARY_CLUSTER" {
name = "PRIMARY_CLUSTER_NAME" # replace with your cluster name
location = "us-central1" # replace with your desired REGION (not a zone)
# Optional: explicitly choose zones within the region for the nodes
node_locations = [
"us-central1-a",
"us-central1-b",
"us-central1-c",
]
remove_default_node_pool = true
initial_node_count = 1
# ...other cluster settings...
}
resource "google_container_node_pool" "PRIMARY_NODE_POOL" {
name = "PRIMARY_NODE_POOL_NAME" # replace with your node pool name
cluster = google_container_cluster.PRIMARY_CLUSTER.name
location = google_container_cluster.PRIMARY_CLUSTER.location
node_count = 3
node_config {
machine_type = "e2-standard-4"
# ...other node config...
}
}
Changing a GKE cluster from zonal to regional is not an in‑place update; Terraform will destroy the existing google_container_cluster and create a new regional one, causing control plane and node replacement and requiring workloads to be redeployed or migrated.
For verification, terraform plan should show the old zonal google_container_cluster marked with -/+ (destroy and recreate) or - (destroy) and the new one with + (create), with location changing from a zone (for example, us-central1-a) to a region (for example, us-central1).