GKE Composites
These composites produce K8s YAML with GKE-specific annotations and configurations. They complement the generic composites by adding GCP service integrations.
WorkloadIdentityServiceAccount
Section titled “WorkloadIdentityServiceAccount”ServiceAccount annotated for GKE Workload Identity:
import { WorkloadIdentityServiceAccount } from "@intentius/chant-lexicon-k8s";
const { serviceAccount, role, roleBinding } = WorkloadIdentityServiceAccount({ name: "app-sa", gcpServiceAccountEmail: "app@my-project.iam.gserviceaccount.com", rbacRules: [ { apiGroups: [""], resources: ["secrets"], verbs: ["get"] }, ], namespace: "prod",});- Sets
iam.gke.io/gcp-service-accountannotation on the ServiceAccount - Optional RBAC rules create a Role + RoleBinding scoped to the namespace
- Requires Workload Identity enabled on the GKE cluster + an IAM policy binding on the GCP SA
GceIngress
Section titled “GceIngress”Ingress with GCE ingress class annotations:
import { GceIngress } from "@intentius/chant-lexicon-k8s";
const { ingress } = GceIngress({ name: "api-ingress", hosts: [ { hostname: "api.example.com", paths: [{ path: "/", serviceName: "api", servicePort: 80 }], }, ], staticIpName: "api-ip", managedCertificate: "api-cert", namespace: "prod",});- Sets
kubernetes.io/ingress.class: "gce"annotation staticIpNamebinds a reserved global static IP viakubernetes.io/ingress.global-static-ip-namemanagedCertificateattaches a GKE-managed SSL certificate vianetworking.gke.io/managed-certificates- Auto-generates FrontendConfig for SSL redirect when
managedCertificateis set (override withsslRedirect: false) frontendConfigfor explicit FrontendConfig reference- Pairs naturally with Config Connector static IP resources
GkeGateway
Section titled “GkeGateway”Gateway API with GKE gateway classes:
import { GkeGateway } from "@intentius/chant-lexicon-k8s";
const { gateway, httpRoute } = GkeGateway({ name: "api-gateway", gatewayClassName: "gke-l7-global-external-managed", hosts: [ { hostname: "api.example.com", paths: [{ path: "/", serviceName: "api", servicePort: 80 }], }, ], certificateName: "api-cert", namespace: "prod",});Gateway class options:
gke-l7-global-external-managed— Global external (default)gke-l7-regional-external-managed— Regional externalgke-l7-rilb— Regional internal
GcePdStorageClass
Section titled “GcePdStorageClass”StorageClass for the GCE Persistent Disk CSI driver:
import { GcePdStorageClass } from "@intentius/chant-lexicon-k8s";
const { storageClass } = GcePdStorageClass({ name: "pd-balanced", type: "pd-balanced", replicationType: "none", allowVolumeExpansion: true,});- Provisions
pd.csi.storage.gke.iovolumes - Disk types:
pd-standard,pd-ssd,pd-balanced(default),pd-extreme replicationTypecontrols regional replication (noneorregional-pd)
FilestoreStorageClass
Section titled “FilestoreStorageClass”StorageClass for the Filestore CSI driver (ReadWriteMany):
import { FilestoreStorageClass } from "@intentius/chant-lexicon-k8s";
const { storageClass } = FilestoreStorageClass({ name: "filestore-shared", tier: "standard", network: "my-vpc",});- ReadWriteMany access — shared across pods and nodes
- Requires the Filestore CSI driver GKE add-on
- Use GCE PD for ReadWriteOnce (single pod), Filestore for ReadWriteMany (shared)
GkeExternalDnsAgent
Section titled “GkeExternalDnsAgent”ExternalDNS for Cloud DNS integration:
import { GkeExternalDnsAgent } from "@intentius/chant-lexicon-k8s";
const result = GkeExternalDnsAgent({ gcpServiceAccountEmail: "dns@my-project.iam.gserviceaccount.com", gcpProjectId: "my-project", domainFilters: ["example.com"], txtOwnerId: "my-cluster",});- Watches Ingress/Service resources and creates Cloud DNS records
- Uses Workload Identity for authentication
domainFiltersrestricts which domains ExternalDNS can manage
GkeFluentBitAgent
Section titled “GkeFluentBitAgent”DaemonSet for Cloud Logging:
import { GkeFluentBitAgent } from "@intentius/chant-lexicon-k8s";
const result = GkeFluentBitAgent({ clusterName: "my-cluster", projectId: "my-project", gcpServiceAccountEmail: "logging@my-project.iam.gserviceaccount.com",});- Deploys Fluent Bit as a DaemonSet with host path mounts for
/var/log - Forwards container logs to Cloud Logging
- Uses Workload Identity for authentication
GkeOtelCollector
Section titled “GkeOtelCollector”OTel collector for Cloud Trace and Cloud Monitoring:
import { GkeOtelCollector } from "@intentius/chant-lexicon-k8s";
const result = GkeOtelCollector({ clusterName: "my-cluster", projectId: "my-project", gcpServiceAccountEmail: "monitoring@my-project.iam.gserviceaccount.com",});- Deploys OTel collector as a DaemonSet collecting metrics and traces
- Exports to Cloud Monitoring and Cloud Trace
- Uses Workload Identity for authentication
ConfigConnectorContext
Section titled “ConfigConnectorContext”Config Connector namespace bootstrap:
import { ConfigConnectorContext } from "@intentius/chant-lexicon-k8s";
const { context } = ConfigConnectorContext({ googleServiceAccountEmail: "cc-sa@my-project.iam.gserviceaccount.com", namespace: "config-connector", stateIntoSpec: "absent",});- Required when using Config Connector to manage GCP resources from within the cluster
- Configures the GCP service account per namespace
stateIntoSpeccontrols whether CC writes observed state back into the spec (absentrecommended)
CockroachDbRegionStack
Section titled “CockroachDbRegionStack”All K8s resources for one CockroachDB region, in a single call — the 8-file per-region pattern (namespace, storage, StatefulSet, External Secrets, ingress, TLS, BackendConfig, monitoring) collapsed into one composite. Backs the CockroachDB Multi-Region tutorial and its example, two calls per region:
import { CockroachDbRegionStack } from "@intentius/chant-lexicon-k8s";
export const east = CockroachDbRegionStack({ region: "east", namespace: "crdb-east", domain: "east.crdb.example.com", internalDomain: "east.crdb.internal", publicRootDomain: "crdb.example.com", projectId: "my-project", clusterName: "gke-crdb-east", clusterRegion: "us-east4", crdbGsaEmail: "gke-crdb-east-crdb@my-project.iam.gserviceaccount.com", externalDnsGsaEmail: "gke-crdb-east-dns@my-project.iam.gserviceaccount.com", cockroachdb: { locality: "cloud=gcp,region=us-east4", joinAddresses: [/* ... */], advertiseHostDomain: "east.crdb.internal", skipInit: false, mountClientCerts: true, }, tls: { gcpSecretNames: { ca: "crdb-ca-crt", nodeCrt: "crdb-node-crt", nodeKey: "crdb-node-key", clientRootCrt: "crdb-client-root-crt", clientRootKey: "crdb-client-root-key", }, }, cloudArmor: { policyName: "crdb-ui-waf" }, monitoring: true,});It emits: a namespace with resource quota, default limits and default-deny NetworkPolicy;
a pd-ssd StorageClass; the CockroachDB StatefulSet, headless + public Services, RBAC and
PodDisruptionBudget (via CockroachDbCluster);
a ClusterSecretStore and two ExternalSecrets pulling node and client certs from GCP
Secret Manager; a ManagedCertificate, FrontendConfig and GceIngress for the public UI;
an ExternalDNS agent for both the public and internal (cross-cluster) domains; and,
optionally, a Cloud Armor BackendConfig and a Prometheus scrape ConfigMap/Deployment/Service.
The props that matter for a multi-region rollout:
cockroachdb.advertiseHostDomain— when set, pods advertise${HOSTNAME}.${advertiseHostDomain}instead of their in-cluster DNS name, so gossip resolves across clusters. Required on every region except a single-cluster deployment.cockroachdb.skipInit— only the first region should run thecockroach initJob; every other region sets thistrue.cockroachdb.mountClientCerts— mounts the client cert secret into the CockroachDB pods sokubectl exec ... -- cockroach sqlworks for multi-region init. Certs still come from TLS/External Secrets either way — this only controls the mount.cloudArmor— when set, attaches a Cloud Armor WAF policy to the public UI Service via a generatedBackendConfig. Omit it and noBackendConfigis emitted.monitoring— emits a lightweight Prometheus scraping/_status/vars(defaultfalse); use it or point an existing Prometheus at the same endpoint, not both.
TLS is always sourced from GCP Secret Manager via External Secrets Operator — unlike
CockroachDbCluster, CockroachDbRegionStack
does not expose skipCertGen; it calls CockroachDbCluster with skipCertGen: true
unconditionally, so no self-signed cert Job is ever emitted here.
Workload Identity vs key-based auth
Section titled “Workload Identity vs key-based auth”| Feature | Workload Identity | Key-based (JSON key file) |
|---|---|---|
| K8s annotation needed | Yes (iam.gke.io/gcp-service-account) | No |
| Composite available | WorkloadIdentityServiceAccount | None needed (mount key as Secret) |
| Setup | GKE cluster WI enabled + IAM binding | Create key → K8s Secret → volume mount |
| Security | No long-lived credentials, auto-rotated | Static key, must rotate manually |
| When to use | Always (recommended) | Legacy workloads, non-GKE clusters |
Workload Identity is the recommended approach for all GKE workloads. Key-based auth requires no K8s-side composite — create a Secret from the JSON key and mount it.
Config Connector considerations
Section titled “Config Connector considerations”Config Connector (CC) runs as a GKE add-on and manages GCP resources declaratively via K8s CRDs:
- Bootstrap cluster required — CC needs an existing GKE cluster to run in; use
npm run bootstrapto create one - CC service account — a GCP SA with editor/IAM roles, bound to the CC controller pod via Workload Identity
- Reconciliation — CC continuously reconciles; deleting a CC resource deletes the underlying GCP resource
- ConfigConnectorContext — use the composite to configure CC per-namespace (SA email, stateIntoSpec policy)
GKE add-ons
Section titled “GKE add-ons”Common add-ons managed via GKE (not K8s manifests):
| Add-on | Required for |
|---|---|
| Config Connector | Managing GCP resources as K8s CRDs |
| Workload Identity | WorkloadIdentityServiceAccount |
| GKE Gateway Controller | GkeGateway |
| GKE managed Prometheus | Alternative to GkeOtelCollector for metrics |
| GKE Dataplane V2 | eBPF-based networking with built-in NetworkPolicy enforcement |
| Filestore CSI driver | FilestoreStorageClass |
| Compute Engine PD CSI driver | GcePdStorageClass (enabled by default) |
Configure add-ons via the GCP Config Connector lexicon.
Further reading
Section titled “Further reading”- GCP GKE + Kubernetes tutorial — full deployment walkthrough
- Deploying to GKE — GCP lexicon bridge page
- Generic composites — WebApp, AutoscaledService, NamespaceEnv, and more