> [!WARNING]
> **Preview:** Online Prediction is a Preview feature that is available as-is and is not recommended for production environments. Google provides no service-level agreements (SLA) or technical support commitments for Preview features. For more information, see GDC's [feature stages](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/resources/feature-stages.md.txt).

This page describes the process to delete an online prediction model and all the
resources associated with it.

## Before you begin

To get the permissions that you need to access Online Prediction,
ask your IAM Project Admin to grant you the Vertex AI
Prediction User (`vertex-ai-prediction-user`) role.

For information about this role, see
[Prepare IAM permissions](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/vertex-ai-ao-permissions.md.txt).

Additionally, to get the permissions that you need to delete objects in a
bucket, ask your IAM Project Admin to grant you the Project Bucket Object Admin
(`project-bucket-object-admin`) role in the project.

## Delete resources

If you want to delete an online prediction model and all the resources
associated with it, perform the following steps:

1. Delete the `DeployedModel` custom resource associated with your model
   on the prediction cluster:

   ```bash
   kubectl --kubeconfig PREDICTION_CLUSTER_KUBECONFIG delete -f DEPLOYED_MODEL_NAME.yaml
   ```

   Replace the following:
   - `PREDICTION_CLUSTER_KUBECONFIG`: the path to the kubeconfig file in the prediction cluster.
   - `DEPLOYED_MODEL_NAME`: the name of the `DeployedModel` definition file.
2. Edit the `Endpoint` custom resource in one of the following ways:

   - If the endpoint that the `DeployedModel` uses doesn't host other models,
     delete the `Endpoint` custom resource on the prediction cluster:

     ```bash
     kubectl --kubeconfig PREDICTION_CLUSTER_KUBECONFIG delete -f ENDPOINT_NAME.yaml
     ```

     Replace `ENDPOINT_NAME` with the name of the
     `Endpoint` definition file.
   - If the endpoint that the `DeployedModel` uses hosts other models,
     perform the following steps:

     1. Update the `Endpoint` custom resource on the prediction cluster:

        ```bash
        kubectl --kubeconfig PREDICTION_CLUSTER_KUBECONFIG edit -f ENDPOINT_NAME.yaml
        ```

        Replace `ENDPOINT_NAME` with the name of the
        `Endpoint` definition file.
     2. On the YAML file, manually delete the `serviceRef` object containing
        the `DeployedModel` reference you deleted previously.

     3. Save the changes on the YAML file.

3. Delete your model from the storage bucket. For more information about how to
   delete objects from storage buckets, see [Delete storage objects in projects](https://docs.cloud.google.com/distributed-cloud/hosted/docs/latest/gdcag/application/ao-user/delete-storage-objects.md.txt).