Search

Chapter 13. Destroying a hosted cluster

download PDF

13.1. Destroying a hosted cluster on AWS

You can destroy a hosted cluster and its managed cluster resource on Amazon Web Services (AWS) by using the command-line interface (CLI).

13.1.1. Destroying a hosted cluster on AWS by using the CLI

You can use the command-line interface (CLI) to destroy a hosted cluster on Amazon Web Services (AWS).

Procedure

  1. Delete the managed cluster resource on multicluster engine Operator by running the following command:

    $ oc delete managedcluster <hosted_cluster_name> 1
    1
    Replace <hosted_cluster_name> with the name of your cluster.
  2. Delete the hosted cluster and its backend resources by running the following command:

    $ hcp destroy cluster aws  \
      --name <hosted_cluster_name> \1
      --infra-id <infra_id> \2
      --role-arn <arn_role> \3
      --sts-creds <path_to_sts_credential_file> \4
      --base-domain <basedomain> 5
    1
    Specify the name of your hosted cluster, for instance, example.
    2
    Specify the infrastructure name for your hosted cluster.
    3
    Specify the Amazon Resource Name (ARN), for example, arn:aws:iam::820196288204:role/myrole.
    4
    Specify the path to your AWS Security Token Service (STS) credentials file, for example, /home/user/sts-creds/sts-creds.json.
    5
    Specify your base domain, for example, example.com.
    Important

    If your session token for AWS Security Token Service (STS) is expired, retrieve the STS credentials in a JSON file named sts-creds.json by running the following command:

    $ aws sts get-session-token --output json > sts-creds.json

13.2. Destroying a hosted cluster on bare metal

You can destroy hosted clusters on bare metal by using the command-line interface (CLI) or the multicluster engine Operator web console.

13.2.1. Destroying a hosted cluster on bare metal by using the CLI

You can use the hcp command-line interface (CLI) to destroy a hosted cluster on bare metal.

Procedure

  • Delete the hosted cluster and its backend resources by running the following command:

    $ hcp destroy cluster agent --name <hosted_cluster_name> 1
    1
    Specify the name of your hosted cluster.

13.2.2. Destroying a hosted cluster on bare metal by using the web console

You can use the multicluster engine Operator web console to destroy a hosted cluster on bare metal.

Procedure

  1. In the console, click Infrastructure Clusters.
  2. On the Clusters page, select the cluster that you want to destroy.
  3. In the Actions menu, select Destroy clusters to remove the cluster.

13.3. Destroying a hosted cluster on OpenShift Virtualization

You can destroy a hosted cluster and its managed cluster resource on OpenShift Virtualization by using the command-line interface (CLI).

13.3.1. Destroying a hosted cluster on OpenShift Virtualization by using the CLI

You can use the command-line interface (CLI) to destroy a hosted cluster and its managed cluster resource on OpenShift Virtualization.

Procedure

  1. Delete the managed cluster resource on multicluster engine Operator by running the following command:

    $ oc delete managedcluster <hosted_cluster_name>
  2. Delete the hosted cluster and its backend resources by running the following command:

    $ hcp destroy cluster kubevirt --name <hosted_cluster_name>

13.4. Destroying a hosted cluster on IBM Z

You can destroy a hosted cluster on x86 bare metal with IBM Z compute nodes and its managed cluster resource by using the command-line interface (CLI).

13.4.1. Destroying a hosted cluster on x86 bare metal with IBM Z compute nodes

To destroy a hosted cluster and its managed cluster on x86 bare metal with IBM Z compute nodes, you can use the command-line interface (CLI).

Procedure

  1. Scale the NodePool object to 0 nodes by running the following command:

    $ oc -n <hosted_cluster_namespace> scale nodepool <nodepool_name> --replicas 0
    Important

    If the compute nodes are not detached from the hosted cluster or are stuck in the Notready state, delete the compute nodes manually by running the following command:

    $ oc --kubeconfig <hosted_cluster_name>.kubeconfig delete node <compute_node_name>
  2. Verify the status of the compute nodes by entering the following command:

    $ oc --kubeconfig <hosted_cluster_name>.kubeconfig get nodes

    After the compute nodes are detached from the hosted cluster, the status of the agents is changed to auto-assign.

  3. Delete the agents from the cluster by running the following command:

    $ oc -n <hosted_control_plane_namespace> delete agent <agent_name>
    Note

    You can delete the virtual machines that you created as agents after you delete the agents from the cluster.

  4. Destroy the hosted cluster by running the following command:

    $ hcp destroy cluster agent --name <hosted_cluster_name> --namespace <hosted_cluster_namespace>

13.5. Destroying a hosted cluster on IBM Power

You can destroy a hosted cluster on IBM Power by using the command-line interface (CLI).

13.5.1. Destroying a hosted cluster on IBM Power by using the CLI

To destroy a hosted cluster on IBM Power, you can use the hcp command-line interface (CLI).

Procedure

  • Delete the hosted cluster by running the following command:

    $ hcp destroy cluster agent
     --name=<hosted_cluster_name> \1
     --namespace=<hosted_cluster_namespace> \2
     --cluster-grace-period <duration> 3
    1
    Replace <hosted_cluster_name> with the name of your hosted cluster.
    2
    Replace <hosted_cluster_namespace> with the name of your hosted cluster namespace.
    3
    Specifies the duration to destroy the hosted cluster completely, for example, 20m0s.

13.6. Destroying a hosted cluster on non-bare metal agent machines

You can destroy hosted clusters on non-bare metal agent machines by using the command-line interface (CLI) or the multicluster engine Operator web console.

13.6.1. Destroying a hosted cluster on non-bare metal agent machines

You can use the hcp command-line interface (CLI) to destroy a hosted cluster on non-bare metal agent machines.

Procedure

  • Delete the hosted cluster and its backend resources by running the following command:

    $ hcp destroy cluster agent --name <hosted_cluster_name> 1
    1
    Replace <hosted_cluster_name> with the name of your hosted cluster.

13.6.2. Destroying a hosted cluster on non-bare metal agent machines by using the web console

You can use the multicluster engine Operator web console to destroy a hosted cluster on non-bare metal agent machines.

Procedure

  1. In the console, click Infrastructure Clusters.
  2. On the Clusters page, select the cluster that you want to destroy.
  3. In the Actions menu, select Destroy clusters to remove the cluster.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.