LATEST VERSION: v1.3 - RELEASE NOTES
Pivotal Container Service v1.3

Deleting Clusters

Page last updated:

This topic describes how to delete a Kubernetes cluster deployed by Pivotal Container Service (PKS). Running the pks delete-cluster command automatically deletes all cluster objects.

If you are using PKS with NSX-T, see vSphere with NSX-T Cluster Objects for a list of vSphere and NSX-T objects that will be deleted as part of the cluster deletion process.

Delete Cluster

Follow the steps below to delete a cluster using the PKS CLI.

  1. On the command line, run the following command to log in:

    pks login -a PKS-API -u USERNAME -k
    
    See Log in to the PKS CLI for more information about the pks login command.

  2. Run pks delete-cluster CLUSTER-NAME to delete a cluster. Replace CLUSTER-NAME with the unique name for your cluster. For example:

    $ pks delete-cluster my-cluster

  3. Confirm cluster deletion by entering y, or cancel cluster deletion by entering n.

    For example:

    Are you sure you want to delete cluster my-cluster? (y/n)

Verify Cluster Deletion

Follow the steps below to verify cluster deletion using the PKS CLI.

  1. To verify cluster deletion, run pks cluster CLUSTER-NAME. Replace CLUSTER-NAME with the unique name for your cluster.

    For example:

    $ pks cluster my-cluster
    Name:                     my-cluster
    Plan Name:                small
    UUID:                     106aabc7-5ecb-4c54-a800-a32eef57a593
    Last Action:              DELETE
    Last Action State:        in progress
    Last Action Description:  Instance deletion in progress
    Kubernetes Master Host:   my-cluster.pks.local
    Kubernetes Master Port:   8443
    Worker Nodes:             3
    Kubernetes Master IP(s):  10.196.219.88
    Network Profile Name:
    
    While PKS is deleting the cluster, the value for Last Action Description is Instance deletion in progress.

  2. Continue running the pks cluster CLUSTER-NAME command to track cluster deletion. The cluster is deleted when the CLI returns Error: Cluster CLUSTER-NAME not found.

  3. Run pks clusters. The cluster you deleted should not appear in the list of PKS clusters.

    Note: If the cluster is not deleted, see Cluster Deletion Fails in Troubleshooting PKS.

Delete Cluster without Prompt

If you do not want the PKS CLI to prompt you to confirm cluster deletion, use the --non-interactive flag.

For example:

$ pks delete-cluster my-cluster --non-interactive

Note: If you use the --non-interactive flag to delete multiple clusters, delete each cluster one by one. Do not create a script that deletes multiple clusters using the --non-interactive flag. If you do, the BOSH Director may hang and become unusable until you log in to BOSH and cancel each deletion task.


Please send any feedback you have to pks-feedback@pivotal.io.

Create a pull request or raise an issue on the source for this page in GitHub