1. Docs
  2. Infrastructure as Code
  3. Get Started
  4. Kubernetes
  5. Destroy stack

Get started with Pulumi and Kubernetes

    Cleanup & destroy the stack

    Our final step is to clean up all of the resources we’ve allocated in this tutorial.

    Run the pulumi destroy command to delete all cloud resources in this project/stack:

    $ pulumi destroy
    
    > pulumi destroy
    

    Just like pulumi up, you’ll be shown a preview to ensure that you want to proceed:

    Previewing destroy (dev):
    
         Type                                        Name            Plan
     -   pulumi:pulumi:Stack                         quickstart-dev  delete
     -   └─ quickstart:index:KubernetesNginxService  my-nginx        delete
     -      ├─ kubernetes:core/v1:Service            nginx           delete
     -      └─ kubernetes:apps/v1:Deployment         nginx           delete
    
    Outputs:
      - ip: "172.183.217.156"
    
    Resources:
        - 4 to delete
    
    Do you want to perform this destroy?  [Use arrows to move, type to filter]
    > yes
      no
      details
    

    As with an update, we can choose no or details; select yes to proceed:

    Do you want to perform this destroy? yes
    Destroying (dev)
    
         Type                                        Name            Status
     -   pulumi:pulumi:Stack                         quickstart-dev  deleted (0.08s)
     -   └─ quickstart:index:KubernetesNginxService  my-nginx        deleted (0.08s)
     -      ├─ kubernetes:core/v1:Service            nginx           deleted (16s)
     -      └─ kubernetes:apps/v1:Deployment         nginx           deleted (0.59s)
    
    Outputs:
      - ip: "172.183.217.156"
    
    Resources:
        - 4 deleted
    
    Duration: 18s
    

    At this stage, your stack still exists, but all cloud resources have been deleted from it.

    Remove the stack

    The final step is to remove the stack itself. Destroy keeps the stack around so that you still have the full history of what happened to the stack. Running pulumi stack rm will delete it entirely, including all history and state snapshots. Be careful, this step cannot be undone!

    $ pulumi stack rm
    
    > pulumi stack rm
    

    You’ll be prompted to confirm the removal. Confirm it to successfully complete this tutorial.

      Neo just got smarter about infrastructure policy automation