Skip to content

Cleanup & Teardown

Remove Red Hat OpenShift AI Models as a Service and its dependencies from your OpenShift cluster with the cleanup script or manual oc commands.

Remove Models as a Service and its dependencies from your OpenShift cluster.

Automated Cleanup

The cleanup script undoes setup-maas.sh in reverse order, checking whether each resource exists before deleting.

./scripts/cleanup-maas.sh

The script prompts for confirmation before deleting anything. Pass --yes to skip the prompt.

Options

FlagDescription
--dry-runPreview what would be deleted without actually deleting
--keep-operatorsSkip operator removal (Phase 7) - useful when you only want to tear down models and config
--from-phase <N>Start from a specific cleanup phase (1-7)
--yesSkip the confirmation prompt

Cleanup Phases

The script runs these phases in order:

PhaseNameWhat it removes
1External ModelsExternalModel CRs, provider API key secrets, external-models namespace
2ObservabilityTelemetry policies, COO / OpenTelemetry / Tempo operators and namespaces
3ModelsMaaSSubscription, MaaSAuthPolicy, MaaSModelRef, LLMInferenceService, llm namespace
4Red Hat OpenShift AI ConfigurationOdhDashboardConfig, DataScienceCluster, DSCInitialization
5MaaS PlatformPostgreSQL deployment / PVC / service, postgres-creds and maas-db-config secrets
6Platform ConfigurationGateway, GatewayClass, Route, Kuadrant CR, user workload monitoring config, MetalLB (if installed)
7OperatorsRHCL, cert-manager, LWS, Red Hat OpenShift AI subscriptions / CSVs, operator namespaces, Red Hat OpenShift AI-managed namespaces

Examples

Preview what would be deleted:

./scripts/cleanup-maas.sh --dry-run

Remove models and config but keep operators installed:

./scripts/cleanup-maas.sh --keep-operators

Remove only the operators (everything else already cleaned up):

./scripts/cleanup-maas.sh --from-phase 7

Manual Cleanup

If you prefer to remove resources selectively, follow these steps in order.

Remove Models

# Delete MaaS governance CRs
oc delete maassubscription --all -n models-as-a-service --ignore-not-found
oc delete maasauthpolicy --all -n models-as-a-service --ignore-not-found
oc delete maasmodelref --all -n llm --ignore-not-found

# Delete model serving
oc delete llminferenceservice --all -n llm --ignore-not-found

# Delete model namespace
oc delete namespace llm --ignore-not-found

Remove RHOAI Configuration

oc delete odhdashboardconfig odh-dashboard-config -n redhat-ods-applications --ignore-not-found
oc delete datasciencecluster default-dsc --ignore-not-found
oc delete dscinitialization default-dsci --ignore-not-found

Remove MaaS Platform (PostgreSQL)

oc delete deployment postgres -n redhat-ods-applications --ignore-not-found
oc delete service postgres -n redhat-ods-applications --ignore-not-found
oc delete pvc postgres-data -n redhat-ods-applications --ignore-not-found
oc delete secret postgres-creds maas-db-config -n redhat-ods-applications --ignore-not-found

# RHOAI 3.5+ mirrored the secret to redhat-ai-gateway-infra
oc delete secret maas-db-config -n redhat-ai-gateway-infra --ignore-not-found

Remove Gateway and Kuadrant

# Gateway resources
oc delete route maas-default-gateway-https -n openshift-ingress --ignore-not-found
oc delete gateway maas-default-gateway -n openshift-ingress --ignore-not-found
oc delete configmap maas-gateway-options -n openshift-ingress --ignore-not-found
oc delete gatewayclass openshift-default --ignore-not-found

# Kuadrant
oc delete kuadrant kuadrant -n kuadrant-system --ignore-not-found
oc delete namespace kuadrant-system --ignore-not-found

Remove Operators

Delete subscriptions first, then CSVs, then namespaces:

# RHCL (shared openshift-operators namespace - only delete the subscription and CSVs)
oc delete subscription rhcl-operator -n openshift-operators --ignore-not-found
oc delete csv -n openshift-operators -l operators.coreos.com/rhcl-operator.openshift-operators= --ignore-not-found

# cert-manager
oc delete subscription openshift-cert-manager-operator -n cert-manager-operator --ignore-not-found
oc delete csv --all -n cert-manager-operator --ignore-not-found
oc delete namespace cert-manager-operator --ignore-not-found

# Leader Worker Set
oc delete subscription leader-worker-set -n openshift-lws-operator --ignore-not-found
oc delete csv --all -n openshift-lws-operator --ignore-not-found
oc delete namespace openshift-lws-operator --ignore-not-found

# RHOAI (last - manages many resources)
oc delete subscription rhods-operator -n redhat-ods-operator --ignore-not-found
oc delete csv --all -n redhat-ods-operator --ignore-not-found
oc delete namespace redhat-ods-operator --ignore-not-found

Wait 60 seconds for the RHOAI operator to clean up managed resources, then remove its namespaces:

oc delete namespace redhat-ods-applications --ignore-not-found
oc delete namespace redhat-ods-monitoring --ignore-not-found
oc delete namespace redhat-ai-gateway-infra --ignore-not-found  # RHOAI 3.5+
oc delete namespace rhods-notebooks --ignore-not-found
oc delete namespace rhoai-model-registries --ignore-not-found
oc delete namespace models-as-a-service --ignore-not-found

What Is Not Removed

The cleanup script does not remove:

  • Pre-existing namespaces (openshift-operators, openshift-monitoring, openshift-ingress)
  • GPU operators (NFD, NVIDIA GPU Operator) - these are installed separately
  • CRDs left behind by operators (OLM does not remove CRDs on operator deletion)
  • Persistent data in external storage (e.g., if you used an external PostgreSQL)

Next step

To reinstall, run ./scripts/setup-maas.sh - see Automated Setup.