Google GKE cluster
AstroPulse creates and runs a Google Kubernetes Engine cluster in your own Google Cloud project, and you pay Google for it directly. Google runs the control plane; you choose the node pools, or use Autopilot and Google runs the nodes too. This page covers what is specific to GKE. The whole walkthrough is Create a cluster.
Before you start
-
A Google Cloud project, its project ID (a name such as
my-project, not the number) and its project number. Both are on the project dashboard under Project info, or:Terminalgcloud config get-value projectgcloud projects describe my-project --format='value(projectNumber)' -
A Google account that can change IAM in that project, signed in to your browser. The connect setup runs as that account in Cloud Shell.
-
Room in the project's quotas for the machines you pick. For GPUs, compare models, zones and prices first under Infrastructure › Accelerators.
In the console
Create a cluster walks through every step. What is particular to Google Cloud:
-
Name and cloud. Pick Google Cloud under Cloud, then the Region.
-
Account. Under How Kubernetes runs, pick Google Kubernetes Engine. Under Your cloud account, enter the Project ID, or pick a project listed after Connected:.
Open zoom view -
Connect. Enter the Google account that owns this project (your sign-in email is filled in) and the Project number, then select Connect this account. Cloud Shell opens in a new tab as that account; run the setup it shows (Connect your GCP project).
Open zoom view -
Kubernetes. Pick a Release Channel and a Cluster Mode (Standard or Autopilot), then a Kubernetes Version. Enable Workload Identity is on. Add Labels if you want them on the cluster.
Open zoom view -
Network. Leave Use Existing VPC Network off to create the cluster's subnet in the project's
defaultnetwork, or turn it on to use your own (Bring your own VPC network).Public node IPs by defaultWithout your own network, the cluster goes in the project's
defaultnetwork. With Private Cluster off, as it is unless you turn it on, the nodes get public IPs. Turn it on for internal IPs only (Private nodes and API access). -
Node groups. Standard mode only: each node pool has a Minimum nodes and Maximum nodes. Autopilot skips this step. A production pair:
system:n2-standard-2, Minimum nodes1, Maximum nodes3, Pricing On-Demand, for AstroPulse's system pods.platform:n2-standard-2, Minimum nodes2, Maximum nodes5, Pricing Spot, for your applications.
You should see
The cluster's page in Infrastructure › Kubernetes reads Ready once GKE has created it and its node pools are up. Its Events tab shows each step, and says why if one fails.
Connect your GCP project
AstroPulse never holds a service account key. The connect setup lets AstroPulse act as a service account in your project through workload identity federation, with short-lived tokens. Connect once per cluster, before you create it.
Connect this account makes a setup script for this cluster and opens Cloud Shell as the Google account you entered. The script stops before it changes anything if Cloud Shell runs as another account or that account cannot open the project. It then:
- Enables the APIs GKE needs:
iam,container,compute,gkehub,gkeconnect,connectgateway,iamcredentials,sts,cloudresourcemanagerandartifactregistry. - Creates a workload identity pool and an identity provider in it.
- Creates a service account and grants it these roles on the project:
container.admin,compute.networkAdmin,compute.viewer,iam.serviceAccountAdmin,gkehub.viewerandgkehub.gatewayEditor. - Grants it
resourcemanager.projectIamAdminunder a condition that limits it to the roles AstroPulse gives node service accounts, andiam.serviceAccountUseron the Compute Engine default service account, so it can create node pools. - Lets AstroPulse act as that service account, then checks that everything is in place.
A setup script runs only within 24 hours of being made, and stops after 15 minutes. Running it again is safe: what exists is kept, what is missing is completed. If you later remove AstroPulse's access in your project, don't run an old script again, since it would grant it again.
Installing Vulnerability Scanning on a cluster later also grants the scanner's service account read access to Artifact Registry in the project. Every cluster in the project shares that grant.
Standard and Autopilot
- Standard (the default): you choose the node pools on the Node groups step. AstroPulse also turns on GKE node auto-provisioning for the cluster, with limits of 10 to 1000 CPU cores and 40 to 4000 GB of memory.
- Autopilot (
autopilot: true): Google adds and removes machines as your workloads need them, and you pay per pod. The wizard skips Node groups, and the manifest carries no node groups: a request that has them is refused.
The mode is set when the cluster is created.
Node pools
GKE resizes each pool between its Minimum nodes and Maximum nodes as pods need room. A minimum of 0 lets a pool scale to zero while nothing runs, which matters most for GPU pools: they cost the same idle as busy. Pricing is On-Demand or Spot; Spot costs less, but Google can take a node back at short notice.
For a GPU pool, choose Request GPU hardware and name the GPU model and Devices per node; AstroPulse picks the machines. GPU node groups need Kubernetes 1.36 or newer. See GPU node groups.
Bring your own VPC network
GKE uses VPC-native networking with one regional subnet that spans every zone of the region. Pods and services take their addresses from two named secondary ranges on that subnet.
Without your own network, AstroPulse creates the cluster's subnet in the project's network named default, on a free range. To choose that range, set networkCIDR in the manifest: a /8 to /29 block inside 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 or 100.64.0.0/10 that no other subnet in the network uses.
To use your own network, turn on Use Existing VPC Network and enter the VPC Network Name, Subnet Name, Pods Secondary Range Name and Services Secondary Range Name. The subnet must already exist in the cluster's region with both secondary ranges. Setup Commands under the fields shows the gcloud commands that create them, filled in with the names you entered:
gcloud compute networks create my-vpc \
--subnet-mode=custom \
--project=my-project
gcloud compute networks subnets create gke-subnet \
--network=my-vpc \
--region=us-central1 \
--range=10.0.0.0/20 \
--secondary-range=pods=10.4.0.0/14 \
--secondary-range=services=10.0.16.0/20 \
--enable-private-ip-google-access \
--project=my-project
# optional
gcloud compute firewall-rules create allow-internal \
--network=my-vpc \
--allow=tcp,udp,icmp \
--source-ranges=10.0.0.0/8 \
--project=my-project
The console suggests these sizes:
| Range | Size | Addresses |
|---|---|---|
| Nodes (primary) | /20 | 4,096 |
| Pods (secondary) | /14 | 262,144, about 1,000 nodes of 110 pods |
| Services (secondary) | /20 | 4,096 |
The dry run checks that the network exists, that the subnet is in the region, and that both secondary ranges exist under the names you gave. More on the layout: Networking.
Private nodes and API access
On the Network step, open the configuration section below the network fields:
- Private Cluster (
privateCluster: true) gives the nodes internal IPs only. On the network AstroPulse uses, it adds a Cloud NAT for their outbound traffic; on your own network, the subnet must already have one, and the dry run checks it. The Kubernetes API server keeps its public endpoint, so restrict it with authorized networks. - Master IPv4 CIDR Block is the control plane's range of a private cluster: exactly a /28 inside
10.0.0.0/8,172.16.0.0/12or192.168.0.0/16. Without one,172.16.0.0/28is used. Change it only if that range is taken in your network. - Authorized Networks are the CIDR blocks that may reach the Kubernetes API server, up to 50, added one at a time. Empty means any address.
Every GKE cluster AstroPulse creates has Shielded Nodes and GKE Dataplane V2. Dataplane V2 enforces the Kubernetes NetworkPolicy objects you create; none exist by default.
Versions
The Release Channel decides which Kubernetes versions you can pick and how GKE upgrades the cluster: RAPID, REGULAR or STABLE. AstroPulse default sends no channel, and the cluster uses STABLE. Each channel card shows the version it defaults to. What each channel means is on Google's release channels page.
Kubernetes Version lists what the channel offers in the region; AstroPulse default uses the channel's default version. In a manifest, <major>.<minor> picks the newest matching version the channel offers. To list them:
astroctl cloud gcp k8s-versions -r us-central1
Updates and upgrades
Upgrades, node pool changes and rollback are on the cluster's Update and Node groups tabs, with a dry run before each change. AstroPulse plans every upgrade one minor version at a time. See Manage a cluster.
Version discovery
Start with the versions and upgrade paths the platform currently returns for this cluster. The console upgrade wizard reads the same list.
# Versions available to this cluster
astroctl infra k8s upgrade <cluster-name> --list-versions
# Versions and upgrade paths available in the region
astroctl cloud gcp k8s-versions -r us-central1
astroctl cloud gcp k8s-versions --show-upgrade-paths
Kubernetes version upgrade
Preview first, review the readiness report, then run the approved upgrade.
# Preview and validate
astroctl infra k8s upgrade <cluster-name> <next-version> --dry-run
# Generate the readiness report
astroctl infra k8s upgrade <cluster-name> <next-version> --generate-report
# Run the approved upgrade
astroctl infra k8s upgrade <cluster-name> <next-version>
Other ways in
- Nova: ask it, for example "create a GKE cluster in my connected project with a small on-demand pool". It shows you the manifest and its dry run before it creates anything.
- SDK and API: the same operations, in the API reference.
With astroctl
astroctl cloud gcp connect --project-id my-project --region us-central1 --cluster-name gke-prod --account owner@example.com
astroctl infra k8s template gke > gke-prod.yaml
astroctl infra k8s apply -f gke-prod.yaml --dry-run
astroctl infra k8s apply -f gke-prod.yaml
connect opens Cloud Shell with the setup script and waits until the project is connected. Without --project-number it looks the number up with your local gcloud; --local saves the script to run in your own terminal instead. Use the same cluster name and region in the manifest. Every flag: astroctl cloud gcp connect and astroctl infra k8s apply.
Settings
The GKE fields. astroctl infra k8s template gke --schema lists every field.
provisioner.gke.projectIdRequiredThe Google Cloud project the cluster is created in.
provisioner.gke.releaseChannelHow GKE upgrades the cluster, and which versions it offers.
StableStable Gets versions after they are proven on Regular.RegularRegular Gets versions after they are proven on Rapid.RapidRapid Gets the newest versions first.
Stable
provisioner.gke.kubernetesVersion<major>.<minor>, <major>.<minor>.<patch> or a full GKE version. A shorter form picks the newest matching version in the channel.
provisioner.gke.autopilottrue for Autopilot; the manifest then has no node groups.
false (Standard)provisioner.gke.enableWorkloadIdentityprovisioner.gke.labelsGoogle Cloud labels on the cluster.
_ and -; keys start with a letter.provisioner.gke.networkIdYour existing VPC network. Needs subnet.
default network.provisioner.gke.subnetThe regional subnet in your network, and the names of its secondary ranges for pods and services. Only with networkId.
provisioner.gke.networkCIDRThe node range of the subnet AstroPulse creates. Only without networkId.
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 or 100.64.0.0/10, unused in the network.provisioner.gke.privateClusterNodes get internal IPs only. The API server keeps its public endpoint.
falseprovisioner.gke.masterIPv4CidrBlockThe control plane's range of a private cluster.
10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16.172.16.0.0/28provisioner.gke.authorizedNetworksCIDR blocks allowed to reach the Kubernetes API server.
If it's refused
gcloud config get-value project.gcloud projects describe my-project --format='value(projectNumber)' and paste what it prints.clusterSpec.dataPlane, or set autopilot: false.networkId is set without subnet.networkId.subnet is set without networkId.networkId, or remove subnet.networkCIDR is set next to your own network.networkCIDR.172.16.0.16/28.privateCluster: true with a credential type other than Dynamic.credentials.type: Dynamic and connect the project.Next
- Create a cluster, the full walkthrough
- Networking
- Cluster access with kubectl
- Cluster add-ons