Manage and uninstall Karpenter
Check the installed Karpenter status and manage node policies, version updates, and removal.
Check status
Check the status of the Karpenter controller and key resources.
kubectl -n karpenter-kakaocloud get deployment,pod
kubectl get kcnodeclass
kubectl get nodepool
kubectl get nodeclaims
kubectl get nodes -l karpenter.sh/nodepool
If resources are not ready or node provisioning or reclamation is delayed, check events and logs as described in Karpenter troubleshooting.
Configure node provisioning and reclamation policies
Use NodePool requirements and limits to configure node provisioning requirements and resource limits. There is no cluster-wide limit, so specify limits for every NodePool.
The main settings are as follows.
| Setting | Location | Description |
|---|---|---|
| Instance requirements | spec.template.spec.requirements | Restrict candidates by instance type, availability zone, CPU, memory, and other conditions |
| Resource limits | spec.limits | Limit the total CPU, memory, and GPU resources a NodePool can provision |
| Consolidation policy | spec.disruption.consolidationPolicy | Set reclamation criteria for empty or underutilized nodes |
| Consolidation delay | spec.disruption.consolidateAfter | Time to wait before reclamation after consolidation conditions are met |
| Node expiration | spec.template.spec.expireAfter | Maximum node lifetime before replacement; default 720h |
| Termination grace period | spec.template.spec.terminationGracePeriod | Maximum time allowed for node draining |
To restrict instance types or availability zones, add the following keys to requirements.
| Purpose | Requirement key | Example value |
|---|---|---|
| Instance type | node.kubernetes.io/instance-type | m2a.large |
| Availability zone | topology.kubernetes.io/zone | kr-central-2-a |
| Instance family | karpenter.kakaocloud.com/instance-family | m2a |
| vCPU | karpenter.kakaocloud.com/instance-cpu | 4 |
| Memory | karpenter.kakaocloud.com/instance-memory | 16384 (MiB) |
Nodes may not be created if you specify an availability zone different from the KCNodeClass subnet or make requirements too restrictive. Do not use requirement keys from other cloud providers.
Set consolidationPolicy to WhenEmpty or WhenEmptyOrUnderutilized. Configure consolidateAfter according to workload characteristics to avoid frequent provisioning and reclamation.
Node reclamation may be delayed if the PodDisruptionBudget has ALLOWED DISRUPTIONS set to 0 or a Pod has the karpenter.sh/do-not-disrupt annotation.
Expiration based on expireAfter is not blocked by disruption budgets or do-not-disrupt. For long-running jobs, set a sufficient expiration period or Never.
For workloads connected to a load balancer, configure replicas, readiness probes, PodDisruptionBudgets, and termination grace periods, and verify that traffic is handled correctly during node reclamation.
The Karpenter Provider's default cost values are relative values for instance selection, not actual billing rates. The instance with the lowest actual rate is not always selected. Check costs against Virtual Machine service pricing and quotas.
Do not change the names or descriptions of Virtual Machines created by Karpenter. They are used to verify ownership and identify remaining instances, and changing them may cause instance reclamation to fail.
Configure monitoring and alerts
Clusters with Prometheus Operator installed can use Karpenter Provider metrics and alert rules. The default value of serviceMonitor.enabled and prometheusRule.enabled is auto. Objects are created only when the relevant CRDs exist.
Set serviceMonitor.additionalLabels and prometheusRule.additionalLabels to match the Prometheus selectors. Metrics and alert rules are not applied if labels do not match.
serviceMonitor:
enabled: true
additionalLabels:
release: <PROMETHEUS_RELEASE_LABEL>
prometheusRule:
enabled: true
additionalLabels:
release: <PROMETHEUS_RELEASE_LABEL>
alertLabels:
team: <TEAM_NAME>
service: karpenter
runbookBaseURL: <RUNBOOK_URL>
Apply monitoring settings while retaining the current installation values.
helm upgrade karpenter-provider-kakaocloud \
oci://ke-container-registry.kr-central-2.kcr.dev/ke-helm-public/karpenter-provider-kakaocloud \
--version '<INSTALLED_CHART_VERSION>' \
--namespace karpenter-kakaocloud \
--reuse-values \
-f karpenter-monitoring-values.yaml
The main alerts related to Kubernetes versions and worker images are as follows.
KarpenterNodeClassKubernetesVersionSkewed(info): The worker version remains one minor version below the control plane. Align the KCNodeClass version and replace the nodes.KarpenterNodeClassKubernetesVersionDeprecated(info): Kubernetes Engine no longer offers the worker version in use. Plan an update to a supported version.KarpenterNodeClassImagesRetained(warning): Images for the current version could not be retrieved, so previously verified images are being used. Change to a supported version or specify a validated image ID.
An info alert does not indicate a condition requiring immediate incident response. To forward alerts externally, configure Alertmanager routes and receivers that match prometheusRule.alertLabels.
Update Kubernetes version
Before updating the control plane, align every Karpenter node to the current control plane minor version. The update request is rejected if even one node has a different version, including NotReady nodes and nodes being registered.
-
Check the Kubernetes versions of Karpenter nodes.
Check Karpenter node Kubernetes versionskubectl get nodes -l karpenter.sh/nodepool -
If any nodes are one minor version below the current control plane, change
spec.bootstrap.kubernetesVersionin the corresponding KCNodeClass to the current control plane version.Change KCNodeClass Kubernetes versionkubectl edit kcnodeclass <KCNODECLASS_NAME> -
Wait for drift replacement of existing nodes to complete, and verify that all Karpenter nodes have the same minor version as the current control plane.
-
Update the Kubernetes Engine control plane. During the update, KCNodeClass
KubernetesVersionReadyandImagesReadymay becomeFalse, temporarily pausing new node provisioning. Existing nodes and Pods continue running. -
Verify that the cluster is stable again and KCNodeClass
KubernetesVersionReadyandImagesReadyareTrue.Check KCNodeClass conditionskubectl get kcnodeclass <KCNODECLASS_NAME> \
-o jsonpath='{range .status.conditions[*]}{.type}{"\t"}{.status}{"\t"}{.reason}{"\n"}{end}' -
Change
spec.bootstrap.kubernetesVersionin KCNodeClass to the new control plane version and verify that nodes are replaced in sequence.
Changing spec.bootstrap.kubernetesVersion makes nodes created from that KCNodeClass eligible for drift replacement. Before changing it, check workload replica counts, PodDisruptionBudgets, and acceptable interruption windows.
Manage deprecated Kubernetes versions
Even if Kubernetes Engine stops offering a Kubernetes version for new configurations, KCNodeClasses already using that version continue to operate. They can retain existing nodes and create new ones.
Check the KCNodeClass condition KubernetesVersionDeprecated=True with reason WorkerVersionNotOffered to identify this state. It also appears in Kubernetes Events and the KarpenterNodeClassKubernetesVersionDeprecated alert.
You cannot specify a deprecated version when creating a new KCNodeClass or changing an existing KCNodeClass version. Check control plane compatibility and update to a version offered by Kubernetes Engine.
If worker images for the specified version cannot be retrieved, Karpenter uses previously verified images. In this state, ImagesReady=True with reason ImagesRetained, and new node provisioning continues.
This state does not clear automatically. Change to a supported version or specify a validated worker image ID in spec.imageID.
Upgrade Karpenter Provider
Before upgrading the Provider, verify that all KCNodeClass worker versions are equal to or one minor version below the control plane.
KCNodeClasses outside this range become Ready=False after the upgrade and cannot create new nodes. Change their versions and complete node replacement before upgrading.
Back up the current configuration and review the release information.
kubectl get nodepool -o yaml > nodepools-before-upgrade.yaml
kubectl get kcnodeclass -o yaml > kcnodeclasses-before-upgrade.yaml
helm get values karpenter-provider-kakaocloud \
-n karpenter-kakaocloud > karpenter-values-before-upgrade.yaml
Helm does not automatically update CRDs in the crds directory during upgrades. If the Provider release specifies CRD changes, apply the CRDs from the new chart first.
helm pull \
oci://ke-container-registry.kr-central-2.kcr.dev/ke-helm-public/karpenter-provider-kakaocloud \
--version '<NEW_CHART_VERSION>' \
--untar
kubectl apply -f karpenter-provider-kakaocloud/crds/
Upgrade the Provider while retaining the current installation values.
helm upgrade karpenter-provider-kakaocloud \
oci://ke-container-registry.kr-central-2.kcr.dev/ke-helm-public/karpenter-provider-kakaocloud \
--version '<NEW_CHART_VERSION>' \
--namespace karpenter-kakaocloud \
--reuse-values \
--wait \
--timeout 10m
If you explicitly set controller.image.* during installation, --reuse-values may retain the existing image settings. To use the controller image included in the new chart, remove the existing image overrides or specify the new image values.
After upgrading, check controller Pods, the Ready status of KCNodeClass and NodePool, and new node provisioning and reclamation. If rollback is necessary, check revisions with helm history and run helm rollback.
Rotate IAM access keys and signing keys
Do not change or recreate the signing key Secret during a Provider upgrade.
When rotating an IAM access key, update the Secret with the new key and restart the controller. Verify that KCNodeClass remains Ready before revoking the old key.
To rotate a signing key, add the new key without removing existing keys from the keyring, and set the new key as activeKeyID. Remove the old key only after verifying that all instances created with it have been replaced.
Delete Karpenter resources
Follow only one of the two procedures below, depending on whether you will retain or delete the Kubernetes Engine cluster.
Retain cluster
Karpenter nodes are not part of managed node pools. Reclaim them by deleting NodeClaims rather than using the Kubernetes Engine node deletion API.
First, change the CPU limit of every NodePool to 0 to block new node provisioning. Run the command for each NodePool. New Pods may remain Pending during this work.
kubectl get nodepool
kubectl patch nodepool <NODEPOOL_NAME> --type merge \
-p '{"spec":{"limits":{"cpu":"0"}}}'
Delete the Karpenter Provider Helm release only after all NodeClaims and instances have been deleted. If you delete the controller first, instances and volumes may remain and continue to incur charges.
-
Move workloads running on Karpenter nodes to other nodes or delete the workloads.
-
Delete NodeClaims. The controller drains the nodes and deletes the connected instances. Repeat for each NodePool if there are multiple NodePools.
Delete NodeClaimskubectl delete nodeclaims \
-l karpenter.sh/nodepool=<NODEPOOL_NAME> -
Verify that all NodeClaims and Karpenter nodes have been deleted. Also check for remaining resources in Virtual Machine > Instances and Volumes in the KakaoCloud Console.
Verify NodeClaim and node deletionkubectl get nodeclaims
kubectl get nodes -l karpenter.sh/nodepoolIf deletion is delayed, check PodDisruptionBudgets,
do-not-disruptannotations, and the NodeClaim events. -
Delete the NodePool and KCNodeClass, and then uninstall the Karpenter Provider. Do not delete a KCNodeClass referenced by another NodePool.
Delete Karpenter resourceskubectl delete nodepool <NODEPOOL_NAME>
kubectl delete kcnodeclass <KCNODECLASS_NAME>
helm uninstall karpenter-provider-kakaocloud \
--namespace karpenter-kakaocloud -
Check again that no instances or volumes remain, and then delete the namespace and revoke the IAM access key dedicated to Karpenter.
Delete Karpenter namespacekubectl delete namespace karpenter-kakaocloud
To also remove CRDs and signing key backups, see Clean up CRDs and signing keys.
If you use a GitOps tool such as Argo CD, remove NodePool manifests from the repository only after all NodeClaims and instances have been deleted.
Delete Kubernetes Engine cluster
When deleting a cluster, follow the procedure below without deleting individual NodeClaims. Virtual Machines created by Karpenter are also included in the deletion targets.
Instances with changed names or descriptions, instances not connected to NodeClaims, and volumes configured to be retained may remain. Always check for remaining resources after deletion.
-
Save NodeClaim names and provider IDs so you can identify remaining resources after deletion. Also record the names and IDs of Karpenter instances and connected volumes in the KakaoCloud Console.
Save NodeClaim information before deletionkubectl get nodeclaims \
-o custom-columns='NODECLAIM:.metadata.name,PROVIDER_ID:.status.providerID' \
> karpenter-before-cluster-delete.txt -
Uninstall the Karpenter Provider and verify that the controller Pods have terminated.
Verify Karpenter Provider shutdownhelm uninstall karpenter-provider-kakaocloud \
--namespace karpenter-kakaocloud
kubectl -n karpenter-kakaocloud get pods \
-l app.kubernetes.io/name=karpenter-provider-kakaocloud -
Delete the cluster using the Kubernetes Engine console or API. The cluster may remain
Deletingwhile Karpenter instances remain. -
After cluster deletion, check Virtual Machine > Instances and Volumes in the KakaoCloud Console for remaining resources. If any resources were not deleted automatically, identify orphaned resources, verify that they belong to the cluster, and then clean them up.
-
Revoke the IAM access key dedicated to Karpenter. Do not revoke a key that is also used for other purposes.