karpenter
Karpenter GCP Cloud Provider — cost-efficient autoscaling for GKE clusters
About this chart
karpenter
Karpenter GCP Cloud Provider — cost-efficient autoscaling for GKE clusters
Karpenter GCP is an open-source node provisioning provider for GKE clusters. It watches for unschedulable pods and automatically provisions cost-efficient GCP nodes to meet workload requirements, removing them when they are no longer needed.
Prerequisites
- Kubernetes 1.26+
- GKE cluster
- GCP service account with Compute Engine permissions (or Workload Identity)
Installation
Use Helm 3.8+ or Helm 4 and select the same release version for both charts. All release versions are distributed through public GHCR OCI packages; no helm repo add is required.
Install the chart:
helm install karpenter oci://ghcr.io/karpenter-gcp/karpenter-provider-gcp/charts/karpenter \
--namespace karpenter \
--create-namespace \
--set controller.image.repository=ghcr.io/karpenter-gcp/karpenter-provider-gcp \
--set controller.settings.projectID=<your-gcp-project> \
--set controller.settings.clusterName=<your-cluster-name> \
--set controller.settings.clusterLocation=<your-region-or-zone>
Authentication
Workload Identity (recommended)
Bind your GCP service account to the Karpenter Kubernetes service account:
gcloud iam service-accounts add-iam-policy-binding \
karpenter@<PROJECT_ID>.iam.gserviceaccount.com \
--role roles/iam.workloadIdentityUser \
--member "serviceAccount:<PROJECT_ID>.svc.id.goog[karpenter/karpenter]"
Then annotate the service account and disable the credentials secret:
helm install karpenter oci://ghcr.io/karpenter-gcp/karpenter-provider-gcp/charts/karpenter \
--set serviceAccount.annotations."iam\.gke\.io/gcp-service-account"=karpenter@<PROJECT_ID>.iam.gserviceaccount.com \
--set credentials.enabled=false \
...
Service Account Key
Create a Kubernetes secret from your service account key file and reference it:
kubectl create secret generic karpenter-gcp-credentials \
--from-file=key.json=/path/to/key.json \
-n karpenter
helm install karpenter oci://ghcr.io/karpenter-gcp/karpenter-provider-gcp/charts/karpenter \
--set credentials.secretName=karpenter-gcp-credentials \
...
Prometheus Operator Integration
Enable automatic metric scraping with a ServiceMonitor when using the Prometheus Operator:
helm install karpenter oci://ghcr.io/karpenter-gcp/karpenter-provider-gcp/charts/karpenter \
--set serviceMonitor.enabled=true \
...
The ServiceMonitor requires the Prometheus Operator CRDs (monitoring.coreos.com/v1) to be installed in your cluster.
Add labels to match your Prometheus instance's selector:
serviceMonitor:
enabled: true
additionalLabels:
release: prometheus
Values
| Key | Type | Default | Description |
|---|---|---|---|
| additionalAnnotations | object | {} | Additional annotations to add into metadata for templated resources (excludes CRDs). |
| additionalLabels | object | {} | Additional labels to add into metadata for templated resources (excludes CRDs). Labels that the chart adds by default will not be overridden by these additional labels. |
| controller.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].labelSelector.matchLabels."app.kubernetes.io/name" | string | "karpenter" | |
| controller.affinity.podAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].topologyKey | string | "kubernetes.io/hostname" | |
| controller.disableControllerWarmup | bool | true | disableControllerWarmup controls whether controller sources (watches/informers) start before leader election is won. Set to false to enable warmup, which pre-populates caches and improves leader failover time. Default true matches karpenter-core default (warmup disabled). |
| controller.env | list | [] | |
| controller.featureGates.capacityBuffer | bool | false | capacityBuffer is ALPHA and is disabled by default. Setting this to true enables CapacityBuffer support for pre-provisioning spare capacity. This provider does not install the CapacityBuffer CRD (GKE provides it natively starting at 1.35.2-gke.1842000) — enabling this on a cluster where the CRD isn't already installed fails at template render time. |
| controller.featureGates.nodeOverlay | bool | false | nodeOverlay is ALPHA and is disabled by default. Setting this will allow the use of node overlay to impact scheduling decisions |
| controller.featureGates.nodeRepair | bool | false | nodeRepair is ALPHA and is disabled by default. When enabled, Karpenter replaces nodes that fail GKE Node Problem Detector health conditions. Repairs respect disruption budgets and replacement capacity, but skip draining unhealthy nodes. |
| controller.featureGates.podDeletionCostManagement | bool | false | podDeletionCostManagement is ALPHA and is disabled by default. Manages pod-deletion-cost annotations so ReplicaSet scale-down prefers nodes targeted for consolidation. When enabled, existing pod-deletion-cost annotations no longer influence Karpenter disruption costs. |
| controller.featureGates.reservedCapacity | bool | false | reservedCapacity enables scheduling to reserved/committed GCP capacity. Disabled: the GCP provider does not yet implement GCE reservation support (#239). |
| controller.featureGates.spotToSpotConsolidation | bool | true | |
| controller.featureGates.staticCapacity | bool | false | staticCapacity is ALPHA and is disabled by default. When enabled, a NodePool with spec.replicas set maintains a fixed number of nodes regardless of pod demand (static node pool). consolidationPolicy and consolidateAfter are ignored on static NodePools. |
| controller.featureGates.terminateFirstDrift | bool | false | terminateFirstDrift is ALPHA and is disabled by default. Allows drift to terminate a node before launching its replacement on a capacity-constrained NodePool. |
| controller.featureGates.terminateFirstRepair | bool | false | terminateFirstRepair is ALPHA and is disabled by default. Allows repair to terminate an unhealthy node before launching its replacement on a capacity-constrained NodePool. Only takes effect with nodeRepair enabled and legacyNodeRepair disabled. |
| controller.healthProbe.port | int | 8081 | |
| controller.image.pullPolicy | string | "IfNotPresent" | |
| controller.image.repository | string | "ghcr.io/karpenter-gcp/karpenter-provider-gcp" | |
| controller.image.tag | string | "" | |
| controller.metrics.port | int | 8080 | |
| controller.priorityClassName | string | "gmp-critical" | |
| controller.replicaCount | int | 2 | |
| controller.resources.requests.cpu | string | "500m" | |
| controller.resources.requests.memory | string | "500Mi" | |
| controller.revisionHistoryLimit | int | 10 | |
| controller.settings.batchIdleDuration | string | "1s" | The maximum amount of time with no new ending pods that if exceeded ends the current batching window. If pods arrive faster than this time, the batching window will be extended up to the maxDuration. If they arrive slower, the pods will be batched separately. |
| controller.settings.batchMaxDuration | string | "10s" | The maximum length of a batch window. The longer this is, the more pods we can consider for provisioning at one time which usually results in fewer but larger nodes. |
| controller.settings.clusterLocation | string | "" | The GCP region for instance type discovery (e.g., us-central1) |
| controller.settings.clusterName | string | "" | The GCP cluster name. |
| controller.settings.defaultNodePoolTemplateName | string | "" | Pin the GKE node pool used as the bootstrap metadata source. When set, Karpenter uses this pool exclusively and returns an error if it is not RUNNING. Leave empty to use automatic discovery (default-pool → first alphabetical RUNNING pool → fallback karpenter-fallback creation). |
| controller.settings.defaultNodepoolServiceAccount | string | "" | Default GCP service account email to attach to provisioned nodes. When set, overrides the Compute Engine default SA. Corresponds to the DEFAULT_NODEPOOL_SERVICE_ACCOUNT env var. Recommended: set to a dedicated SA with roles/container.nodeServiceAccount. Can be overridden per-NodeClass via GCENodeClass.spec.serviceAccount. |
| controller.settings.ignoreDRARequests | bool | true | ignoreDRARequests controls whether Karpenter ignores pods' Dynamic Resource Allocation requests during scheduling simulations. Keep true unless the cluster has DRA drivers and resource claims that Karpenter should account for. |
| controller.settings.ipSpaceExhaustedTTL | string | "" | How long an instance type, zone and capacity type stays unavailable after a launch fails with IP_SPACE_EXHAUSTED on every pod range (e.g. 1m). Leave empty for the controller default of 30s. Must be positive. Corresponds to the IP_SPACE_EXHAUSTED_TTL env var. |
| controller.settings.launchTimeout | string | "" | How long a NodeClaim may keep failing to launch with a non-capacity error before it is deleted and replaced (e.g. 10m). Leave empty for the controller default of 5m. Must be positive. Corresponds to the LAUNCH_TIMEOUT env var. |
| controller.settings.legacyNodeRepair | bool | false | Run the legacy forceful node repair controller instead of budgeted voluntary repair. Only takes effect with nodeRepair enabled. Terminate-first repair is ignored in legacy mode. |
| controller.settings.nodeLocation | string | "" | The exact GCP cluster location for GKE API calls (e.g., us-central1-a for zonal, us-central1 for regional). If not set, defaults to 'clusterLocation' for backward compatibility. |
| controller.settings.preferencePolicy | string | "Respect" | preferencePolicy controls how Karpenter handles soft scheduling preferences. Respect is the default; Ignore disregards preferred node/pod affinity and anti-affinity plus ScheduleAnyway topology spread constraints. |
| controller.settings.projectID | string | "" | The GCP project ID. |
| controller.settings.quotaExceededTTL | string | "" | How long an instance type stays unavailable in the region after a launch fails with QUOTA_EXCEEDED (e.g. 1h). Leave empty for the controller default of 30m; set to 0s to disable quota backoff. Corresponds to the QUOTA_EXCEEDED_TTL env var. |
| controller.settings.schedulerConfig | object | {} | Optional kube-scheduler behavior to mirror during scheduling simulations. Supports podTopologySpread.defaultConstraints; leave empty unless matching a known cluster scheduler configuration. |
| controller.settings.stockoutTTL | string | "" | How long an instance type, zone and capacity type stays unavailable after a launch fails with ZONE_RESOURCE_POOL_EXHAUSTED (e.g. 2m). Leave empty for the controller default of 5m. Must be positive. Corresponds to the STOCKOUT_TTL env var. |
| controller.settings.telemetry | bool | false | Send anonymized resource totals and Spot interruption events to CloudPilot AI. Off by default. See docs/settings.md#telemetry for exactly what is sent. Corresponds to the TELEMETRY env var. |
| controller.settings.unsupportedConfigurationTTL | string | "" | How long an instance type, zone and capacity type stays unavailable after GCE reports the zone does not support the requested configuration (e.g. 6h). Leave empty for the controller default of 1h. Must be positive. Corresponds to the UNSUPPORTED_CONFIGURATION_TTL env var. |
| controller.settings.vmMemoryOverheadPercent | float | 0.065 | The VM memory overhead as a percent that will be subtracted from the total memory for all instance types. The value of 0.075 equals to 7.5%. |
| controller.strategy.rollingUpdate.maxUnavailable | int | 1 | |
| controller.terminationGracePeriodSeconds | int | 30 | |
| controller.tolerations | list | [] | |
| controller.topologySpreadConstraints | list | [] | |
| credentials | object | {"enabled":true,"secretKey":"key.json","secretName":""} | GCP credentials configuration |
| credentials.enabled | bool | true | Enable or disable the use of GCP credentials secret Set to true if you want to use a Kubernetes secret for GCP authentication Set to false to rely on other authentication methods (e.g., Workload Identity, instance metadata) |
| credentials.secretKey | string | "key.json" | Key within the secret that contains the service account JSON |
| credentials.secretName | string | "" | Name of the existing secret containing GCP credentials If not specified, defaults to "-gcp-credentials" This secret should contain a service account key file |
| fullnameOverride | string | "" | |
| imagePullSecrets | list | [] | |
| logErrorOutputPaths | list | ["stderr"] | Log errorOutputPaths - defaults to stderr only |
| logLevel | string | "info" | Global log level, defaults to 'info' |
| logOutputPaths | list | ["stdout"] | Log outputPaths - defaults to stdout only |
| nameOverride | string | "" | |
| node-problem-detector | object | {"enabled":false,"hostNetwork":true,"nodeSelector":{"karpenter.sh/capacity-type":"spot"},"resources":{"limits":{"memory":"64Mi"},"requests":{"cpu":"10m","memory":"32Mi"}},"securityContext":{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"privileged":false,"readOnlyRootFilesystem":true},"tolerations":[{"operator":"Exists"}],"volume":{"localtime":{"enabled":false}}} | Optional node-problem-detector deployment that watches the GCE metadata server for Spot preemption notices and sets the GCESpotPreempting node condition, which Karpenter's interruption controller reacts to. Pair it with GCENodeClass.spec.preemptionNoticeDuration: 120s for a two-minute drain window. Uses ports 20258 (Prometheus) and 20259 (server) to avoid GKE's managed detector. See docs/spot-preemption.md. |
| node-problem-detector.enabled | bool | false | Deploy node-problem-detector with the Spot preemption |
Deploy karpenter with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has karpenter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartkarpenter is pinned at v0.8.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply