When working with Google Kubernetes Engine (GKE), you might encounter the frustrating quota error:
Insufficient regional quota to satisfy request for resource: "CPUS".
The request requires '4.0' and is short '12.0'.
The regional quota is '8.0' with '-8.0' available.
This typically occurs when your project's Compute Engine CPU quota is exhausted in the specific region where you're trying to create resources.
First, verify your current quota allocation and usage:
gcloud compute regions describe [REGION_NAME] \
--project=[PROJECT_ID] \
--format="value(quotas)"
Or for a more detailed view:
gcloud compute project-info describe \
--project [PROJECT_ID] \
--format="value(quotas)"
Sometimes "hidden" resources might be consuming your quota:
# List all compute instances across all zones
gcloud compute instances list --filter="status=RUNNING" --uri
# Check for pending operations
gcloud compute operations list \
--filter="status!=DONE" \
--limit=10
- Unterminated instances from previous failed deployments
- Managed instance groups maintaining minimum nodes
- Preemptible VMs counting against quota
- GPUs or other accelerators consuming CPU quota
To request more quota through gcloud:
gcloud alpha services quota increase \
--service=compute.googleapis.com \
--quota=CPUS \
--value=16 \
--dimension=region:[REGION_NAME] \
--project=[PROJECT_ID]
If you can't increase quota immediately, consider:
# Reduce node count
gcloud container clusters create "server-cluster" \
--machine-type "n1-standard-1" \
--num-nodes "2" \
...
# Use smaller machine types
gcloud container clusters create "server-cluster" \
--machine-type "g1-small" \
--num-nodes "4" \
...
# Try different regions
gcloud container clusters create "server-cluster" \
--region "us-central1" \
...
Add this to your teardown script to ensure complete cleanup:
#!/bin/bash
# Delete cluster
gcloud container clusters delete server-cluster --quiet
# Delete orphaned disks
gcloud compute disks list --filter="-users:*" --format="value(name)" | \
xargs -I {} gcloud compute disks delete {} --quiet
# Delete unused firewall rules
gcloud compute firewall-rules list \
--filter="targetTags:(gke-server-cluster)" \
--format="value(name)" | \
xargs -I {} gcloud compute firewall-rules delete {} --quiet
Remember that some resources like persistent disks and load balancers might remain after cluster deletion and continue consuming quota.
Set up alerts for quota thresholds:
gcloud alpha monitoring policies create \
--policy-from-file=quota-policy.json
Example quota-policy.json:
{
"displayName": "CPU Quota Alert",
"conditions": [{
"displayName": "CPU quota usage exceeds 90%",
"conditionThreshold": {
"filter": "metric.type=\"compute.googleapis.com/quota/cpus/usage\"",
"aggregations": [{
"alignmentPeriod": "60s",
"perSeriesAligner": "ALIGN_MEAN"
}],
"comparison": "COMPARISON_GT",
"thresholdValue": 0.9,
"duration": "60s"
}
}]
}
When you encounter the error message "Insufficient regional quota to satisfy request for resource: 'CPUS'", it means your Google Cloud Platform project has reached its regional compute engine CPU quota limit. This typically occurs when:
- Your project has active VMs that haven't been properly terminated
- You're exceeding your organization's quota limits
- There are pending operations consuming your quota
To investigate your quota situation, run these commands:
# List all quotas for your project
gcloud compute project-info describe --project [PROJECT_ID]
# Check specific compute quota
gcloud compute regions describe [REGION_NAME] --format="json(quotas)"
In the Google Cloud Console, you can view quotas under:
IAM & Admin → Quotas → Filter by "Compute Engine API" and your region
To find all running instances that count against your quota:
# List all instances in the region
gcloud compute instances list --filter="zone:[REGION]-*"
# Check for instances in TERMINATED status
gcloud compute instances list --filter="status=TERMINATED"
Try these approaches to resolve the CPU quota issue:
1. Request Quota Increase
# Navigate to the quota page in Cloud Console
# Select the specific quota and click "Edit Quotas"
# Follow the process to request an increase
2. Clean Up Orphaned Resources
# Delete unused instances
gcloud compute instances delete [INSTANCE_NAME] --zone=[ZONE]
# Check for pending operations
gcloud compute operations list --filter="status!=DONE"
3. Modify Your Cluster Configuration
Adjust your GKE cluster creation command to use fewer resources:
gcloud container clusters create "server-cluster" \
--machine-type "e2-small" \ # Smaller instance type
--num-nodes "2" \ # Reduce node count
--region [ALTERNATE_REGION] # Try a different region
Implement these practices to avoid future quota issues:
# Set up quota alerts
gcloud alpha monitoring policies create \
--policy-from-file=quota-alert-policy.json
# Use Terraform to manage resources
resource "google_container_cluster" "primary" {
name = "server-cluster"
location = var.region
initial_node_count = 2
node_config {
machine_type = "e2-small"
}
}
If the issue persists after trying the above solutions:
- Check for organization-level quota restrictions
- Verify your billing account is active
- Contact GCP support with your project number and quota details
Remember that some operations like cluster creation may temporarily reserve resources during provisioning, which could trigger quota errors even if resources are eventually released.