honlicious
honlicious

Reputation: 13

Unable to delete gcloud composer environment

I'm trying to delete gcloud environments. One did not successfully create (no associated Airflow or Bucket) and one did. When I attempt to delete, I get an error message (after a really long time) of RPC Skipped due to required preoperation not finished yet. The logs don't provide any valuable information, and I wasn't able to find anything wrong in the cluster. The only solution I have found so far is to delete the entire project, but I would prefer not to. Any suggestions would be greatly appreciated!

Upvotes: 0

Views: 1367

Answers (3)

Evgeniy
Evgeniy

Reputation: 714

I got this issue when I tried to create and delete Cloud Composer by Terraform. I created a Service Account apart from the Composer and this led to deletion it in the first order during a terraform destroy operation.

So the correct order is:

  1. Delete Composer environment
  2. Delete Composer’s Service Account

Upvotes: 1

Ramster
Ramster

Reputation: 31

I would like to share what worked for me in case someone else runs into this problem as I followed all the steps above and still could not delete the composer environment.

My 'gcloud composer environments list' command was returning '0', but I could see my environment was still in the console view and when I tried to delete it, I would get the same error message as honlicious. Additionally, I ran 'gcloud projects add-iam-policy-binding' to try to give my Compute Engine ServiceAccount the composer.serviceAgent role, but this still did not resolve my issue. What eventually worked was disabling the Cloud Composer API and then re-enabling it. This removed my old environment I was unable to previously delete.

Upvotes: 1

itroulli
itroulli

Reputation: 2094

Follow the steps below to delete the environment's resources manually:

  • Delete GKE cluster that corresponds to the environment
  • Delete the Google Storage bucket used by the environment
  • Delete the related deployment with: gcloud deployment-manager deployments delete <DEPLOYMENT_NAME> --delete-policy=ABANDON
  • Then try again to delete the Composer environment with: gcloud composer environments delete <ENVIRONMENT_NAME> --location <LOCATION>

Upvotes: 1

Related Questions