GCP.Container reference
Cluster
Section titled “Cluster”Source:
src/GCP/Container/Cluster.ts
A Google Kubernetes Engine cluster.
Changing clusterId, location, description, network,
subnetwork, ipAllocationPolicy, private-node topology, autopilot,
enableKubernetesAlpha, or default-pool node shape
(initialNodeCount, machineType, diskSizeGb, diskType, spot,
preemptible, serviceAccount, oauthScopes) replaces the cluster —
except that default-pool props are ignored on update while
removeDefaultNodePool is set. Labels, endpoint access, Shielded Nodes,
addons, datapath, logging/monitoring, cost management, release channel,
and node locations update in place.
Provisioning typically takes several minutes.
Cluster: Creating a Cluster
Section titled “Cluster: Creating a Cluster”Generated name, zonal default pool
const cluster = yield* GCP.Container.Cluster("App", {});Explicit id, labels, and Spot nodes
const cluster = yield* GCP.Container.Cluster("App", { clusterId: "app-cluster", location: "us-central1-a", machineType: "e2-medium", initialNodeCount: 1, spot: true, labels: { env: "prod" },});Cluster: Private Clusters
Section titled “Cluster: Private Clusters”const nodes = yield* GCP.IAM.ServiceAccount("GkeNodes", {});const cluster = yield* GCP.Container.Cluster("App", { network: network.networkName, subnetwork: subnet.subnetworkName, ipAllocationPolicy: { useIpAliases: true, clusterSecondaryRangeName: "pods", servicesSecondaryRangeName: "services", }, privateClusterConfig: { enablePrivateNodes: true, masterIpv4CidrBlock: "172.16.0.0/28", }, masterAuthorizedNetworksConfig: { enabled: true, cidrBlocks: [{ cidrBlock: "203.0.113.0/24", displayName: "office" }], }, datapathProvider: "ADVANCED_DATAPATH", enableShieldedNodes: true, serviceAccount: nodes.email, removeDefaultNodePool: true, deletionProtection: true,});yield* GCP.Container.NodePool("Workers", { cluster: cluster.name, serviceAccount: nodes.email, shieldedInstanceConfig: { enableSecureBoot: true },});Cluster: Autopilot
Section titled “Cluster: Autopilot”const cluster = yield* GCP.Container.Cluster("App", { location: "us-central1", autopilot: true, releaseChannel: "REGULAR",});Cluster: Reading a Cluster
Section titled “Cluster: Reading a Cluster”const getCluster = yield* GCP.Container.GetCluster(cluster);const live = yield* getCluster();Cluster: Kubernetes Workloads
Section titled “Cluster: Kubernetes Workloads”const cluster = yield* GCP.Container.Cluster("App", {});const api = yield* Kubernetes.Deployment("Api", { cluster, main: import.meta.url, port: 8080,});ClustersNodePool
Section titled “ClustersNodePool”Source:
src/GCP/Container/ClustersNodePool.ts
A Google Kubernetes Engine node pool managed through the legacy zonal
Container API (projects.zones.clusters.nodePools).
Prefer GCP.Container.NodePool (the projects.locations API) unless
you specifically need the zonal endpoints. Changing cluster, zone,
nodePoolId, spot, preemptible, serviceAccount, oauthScopes,
localSsdCount, bootDiskKmsKey, maxPodsPerNode, metadata,
shieldedInstanceConfig, or advancedMachineFeatures replaces the pool.
Size, labels, machine type, disk, image, version, workload metadata,
management, autoscaling, and upgrade settings update in place.
Provisioning typically takes several minutes.
ClustersNodePool: Creating a Zonal Node Pool
Section titled “ClustersNodePool: Creating a Zonal Node Pool”Generated name on an existing cluster
const cluster = yield* GCP.Container.Cluster("App", { location: "us-central1-a",});const pool = yield* GCP.Container.ClustersNodePool("Workers", { cluster: cluster.clusterId, zone: cluster.location,});Explicit id, Spot nodes, and labels
const pool = yield* GCP.Container.ClustersNodePool("Workers", { cluster: cluster.name, nodePoolId: "app-workers", nodeCount: 1, machineType: "e2-small", diskSizeGb: 20, spot: true, labels: { env: "prod" },});ClustersNodePool: Autoscaling
Section titled “ClustersNodePool: Autoscaling”const pool = yield* GCP.Container.ClustersNodePool("Workers", { cluster: cluster.clusterId, zone: "us-central1-a", autoscaling: { enabled: true, minNodeCount: 1, maxNodeCount: 3 },});ClustersNodePool: Reading a Node Pool
Section titled “ClustersNodePool: Reading a Node Pool”const getPool = yield* GCP.Container.GetClustersNodePool(pool);const live = yield* getPool();GetCluster
Section titled “GetCluster”Source:
src/GCP/Container/GetCluster.ts
Runtime binding for GKE clusters.get.
Bind this operation to a Cluster in a Function/Action init
phase. Provide GetClusterHttp.
GetCluster: Observing Clusters
Section titled “GetCluster: Observing Clusters”const getCluster = yield* GCP.Container.GetCluster(cluster);const live = yield* getCluster();GetClusterHttp
Section titled “GetClusterHttp”Source:
src/GCP/Container/GetClusterHttp.tsKind: Layer · Provides:GCP.Container.GetCluster
HTTP implementation of GetCluster.
GetClustersNodePool
Section titled “GetClustersNodePool”Source:
src/GCP/Container/GetClustersNodePool.ts
Runtime binding for GKE zonal nodePools.get.
Bind this operation to a ClustersNodePool in a Function/Action
init phase. Provide GetClustersNodePoolHttp.
GetClustersNodePool: Observing Zonal Node Pools
Section titled “GetClustersNodePool: Observing Zonal Node Pools”const getPool = yield* GCP.Container.GetClustersNodePool(pool);const live = yield* getPool();GetClustersNodePoolHttp
Section titled “GetClustersNodePoolHttp”Source:
src/GCP/Container/GetClustersNodePoolHttp.tsKind: Layer · Provides:GCP.Container.GetClustersNodePool
HTTP implementation of GetClustersNodePool.
GetNodePool
Section titled “GetNodePool”Source:
src/GCP/Container/GetNodePool.ts
Runtime binding for GKE nodePools.get.
Bind this operation to a NodePool in a Function/Action init
phase. Provide GetNodePoolHttp.
GetNodePool: Observing Node Pools
Section titled “GetNodePool: Observing Node Pools”const getNodePool = yield* GCP.Container.GetNodePool(pool);const live = yield* getNodePool();GetNodePoolHttp
Section titled “GetNodePoolHttp”Source:
src/GCP/Container/GetNodePoolHttp.tsKind: Layer · Provides:GCP.Container.GetNodePool
HTTP implementation of GetNodePool.
NodePool
Section titled “NodePool”Source:
src/GCP/Container/NodePool.ts
A Google Kubernetes Engine node pool.
Node pools belong to a Cluster. Changing cluster, location,
nodePoolId, spot, preemptible, serviceAccount, oauthScopes,
localSsdCount, bootDiskKmsKey, maxPodsPerNode, metadata,
shieldedInstanceConfig, or advancedMachineFeatures replaces the pool.
Size, labels, machine type, disk, image, version, workload metadata,
management, autoscaling, and upgrade settings update in place.
Provisioning typically takes several minutes.
NodePool: Creating a Node Pool
Section titled “NodePool: Creating a Node Pool”Generated name on an existing cluster
const cluster = yield* GCP.Container.Cluster("App", {});const pool = yield* GCP.Container.NodePool("Workers", { cluster: cluster.clusterId, location: cluster.location,});Explicit id, Spot nodes, and labels
const pool = yield* GCP.Container.NodePool("Workers", { cluster: cluster.name, nodePoolId: "app-workers", nodeCount: 1, machineType: "e2-small", diskSizeGb: 20, spot: true, labels: { env: "prod" },});NodePool: Autoscaling
Section titled “NodePool: Autoscaling”const pool = yield* GCP.Container.NodePool("Workers", { cluster: cluster.clusterId, location: cluster.location, autoscaling: { enabled: true, minNodeCount: 1, maxNodeCount: 3 },});NodePool: Reading a Node Pool
Section titled “NodePool: Reading a Node Pool”const getNodePool = yield* GCP.Container.GetNodePool(pool);const live = yield* getNodePool();