This guide covers safe uninstallation of the ngrok-operator, ensuring proper cleanup of ngrok API resources and preventing stuck Kubernetes resources.
helm uninstall ngrok-operator -n ngrok-operatorThe pre-delete hook automatically triggers drain mode, waits for cleanup, then completes uninstall.
# 1. Trigger drain
kubectl delete kubernetesoperator <name> -n <namespace>
# 2. Wait for completion
kubectl wait --for=delete kubernetesoperator/<name> -n <namespace> --timeout=300s
# 3. Delete operator resources
kubectl delete -f operator-manifests.yamlConfigure via the drainPolicy Helm value:
| Policy | ngrok API Resources | Best For |
|---|---|---|
| Retain (default) | Preserved in your account | Production - keep your configuration |
| Delete | Removed from your account | Dev/testing - clean slate |
Both policies remove finalizers from all managed Kubernetes resources.
kubectl get kubernetesoperator <name> -n <namespace> -o yamlStatus fields:
drainStatus:pending→draining→completed/faileddrainProgress:X/Y(processed/total)drainErrors: Error messages if any
When multiple operator instances exist, drain only affects resources managed by that instance:
- Ingress: Filtered by
IngressClass - Gateway/Routes: Filtered by
GatewayClass - Other resources: Filtered by namespace (if
watchNamespaceis set)
- Check if operator is running:
kubectl get pods -n ngrok-operator - Manual finalizer removal (may orphan ngrok resources):
kubectl patch ingress <name> -n <namespace> \ --type=json -p='[{"op":"remove","path":"/metadata/finalizers"}]'
- Or re-install temporarily to let it clean up properly
Increase the hook timeout:
cleanupHook:
timeout: 600 # 10 minutesDelete manually from ngrok Dashboard or via the ngrok CLI.
drainPolicy: "Retain" # or "Delete"
cleanupHook:
enabled: true # default
timeout: 300 # secondsSee internal/drain/ for implementation:
| Component | Role |
|---|---|
Orchestrator |
Coordinates the drain workflow |
StateChecker |
Detects drain mode (caches once triggered) |
Drainer |
Processes resources based on policy |
Controllers check drain.IsDraining() before adding finalizers or syncing new resources.