IPIでインストールされたOpenShift環境をアンインストールしてみた

# 1. はじめに

[OpenShift v4.13をIBM Cloud VPCへIPIインストールしてみた](https://qiita.com/testnin2/items/68fb70b1100957b2e246)の続き。この環境を削除してみた。

削除についての記述は[ここ](https://docs.openshift.com/container-platform/4.12/installing/installing_ibm_cloud_public/uninstalling-cluster-ibm-cloud.html)に記載がある。

# 2. OCPの削除

```
[root@new-syasuda-tok1-vpc1 ~]# ./openshift-install destroy cluster --dir ocp4-ipi --log-level info
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-0"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-1"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Stopped instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Listing disks
INFO Deleted instance "syasuda-ocp-ipi-x24rk-worker-2-n9b4w"
INFO Deleted instance "syasuda-ocp-ipi-x24rk-worker-1-vtnj4"
INFO Deleted instance "syasuda-ocp-ipi-x24rk-worker-3-6rkfh"
INFO Deleted instance "syasuda-ocp-ipi-x24rk-master-0"
INFO Deleted instance "syasuda-ocp-ipi-x24rk-master-1"
INFO Deleted instance "syasuda-ocp-ipi-x24rk-master-2"
INFO Deleted load balancer "syasuda-ocp-ipi-x24rk-kubernetes-api-public"
INFO Deleted load balancer "syasuda-ocp-ipi-x24rk-kubernetes-api-private"
INFO Deleted load balancer "kube-syasuda-ocp-ipi-x24rk-a29a9fd907d149d28e1438a99f08f652"
INFO Skipping deletion of user-provided subnets [02e7-6e131498-ed24-4bd3-9399-24636a8e71b8 02f7-304ec82e-f0b9-40fc-a1b5-f80b13f2d282 02g7-a0cfc9d8-3caa-4cc2-9b22-b64667a4e034 02e7-6e131498-ed24-4bd3-9399-24636a8e71b8 02f7-304ec82e-f0b9-40fc-a1b5-f80b13f2d282 02g7-a0cfc9d8-3caa-4cc2-9b22-b64667a4e034]
INFO Skipping deletion of public gateways in case of user-provided subnets
INFO Deleted security group rule "r022-e513adb2-2fe5-4b41-8ddf-ef640011abda"
INFO Deleted security group rule "r022-6f5efa47-54ec-44f3-86e1-83f4d32ac65e"
INFO Deleted security group rule "r022-a20c3f98-bc12-4335-91fa-30b7531ea6f3"
INFO Deleted security group rule "r022-85ce2e26-0712-4908-99e0-111ca7d31044"
INFO Deleted security group rule "r022-75d41398-1a8e-4272-b2e5-5d232db35974"
INFO Deleted security group rule "r022-961bfc5b-0771-4a85-bcdd-a94069da84bb"
INFO Deleted security group rule "r022-2aea438c-3931-4a5d-9d04-1632e6422957"
INFO Deleted security group rule "r022-ddbd0c3c-2250-403d-bcc3-a468816609cd"
INFO Deleted security group rule "r022-49a32eb8-5545-4100-9f98-ea5ef2f3dd0d"
INFO Deleted security group rule "r022-2eabb803-d0da-4924-b3ba-24fc4c03de43"
INFO Deleted security group rule "r022-be2f3c56-2000-4d85-bca8-f1e387941130"
INFO Deleted security group rule "r022-1a83812e-79ca-483e-a017-182e099bd6e7"
INFO Deleted security group rule "r022-71ff2306-ad81-41c1-9d9c-ae11579bbb24"
INFO Deleted security group rule "r022-22073d04-300a-442b-aa76-c4e6f33060f3"
INFO Deleted security group rule "r022-06b96c53-37b9-4318-af74-e63320ce7d50"
INFO Deleted security group rule "r022-64cc5039-12f4-44e8-8439-f6d5cdc0ce75"
INFO Deleted security group rule "r022-835ab5de-1465-4d6b-9890-e8ea556f7997"
INFO Deleted security group rule "r022-6fef7894-a1b4-4f80-af1d-79e1791cf367"
INFO Deleted security group rule "r022-9e5d4158-a052-4d17-9cab-324cfcb2157f"
INFO Deleted security group rule "r022-df2c3042-a33c-4bef-96f6-d6b55e34e1a7"
INFO Deleted security group rule "r022-0da8d933-ceaf-4555-afe1-3295abd2e996"
INFO Deleted security group rule "r022-37cc9a60-a02a-44d9-a527-4de859de65c1"
INFO Deleted security group rule "r022-30778161-6697-4da3-b96e-e3dfdf14d494"
INFO Deleted security group rule "r022-a1cfc321-3d2c-4a4a-ab3f-8d3a7d4d6eb3"
INFO Deleted security group rule "r022-0b47a2a6-2a5f-4162-923c-2b54598036a8"
INFO Deleted security group rule "r022-89753c5a-0d9f-4d8c-a3a7-938855b912fe"
INFO Deleted security group rule "r022-ecd2046e-e8cf-4039-aab9-4c2ec12a4238"
INFO Deleted security group rule "r022-b8ae2592-9e1a-4bfa-9e62-99f3f765e4e0"
INFO Deleted security group rule "r022-e71d0e2c-be77-486c-8767-c69ddb2934f8"
INFO Deleted security group rule "r022-730911b8-15a6-4ef5-921d-a87d55a04842"
INFO Deleted security group rule "r022-743832c4-c44b-4503-b0b6-c1796624fc84"
INFO Deleted security group rule "r022-dc54501a-1dd4-4b31-8925-f4ac50e08b22"
INFO Deleted security group rule "r022-9630609c-736a-44be-ae75-55b7244b537c"
INFO Deleted security group rule "r022-4e2316ac-a67e-4ee3-bec2-a4731fc36d4a"
INFO Deleted security group rule "r022-c44b3052-53aa-468c-bc91-ce4e4fecd5da"
INFO Deleted security group rule "r022-deea1a40-1e34-4068-8e79-c509b36c2a63"
INFO Deleted security group "syasuda-ocp-ipi-x24rk-sg-kube-api-lb"
INFO Deleted security group "syasuda-ocp-ipi-x24rk-sg-openshift-net"
INFO Deleted security group "syasuda-ocp-ipi-x24rk-sg-cp-internal"
INFO Deleted security group "syasuda-ocp-ipi-x24rk-sg-cluster-wide"
INFO Deleted security group "syasuda-ocp-ipi-x24rk-sg-control-plane"
INFO Skipping deletion of user-provided VPC "vpc-tok-syasuda1"
INFO Reclaimed 250f34f3-3434-4752-a13b-9d849831cc84
INFO Reclaimed 3e3d3a3f-b149-49b3-a376-95f9e50f7938
INFO Deleted COS instance syasuda-ocp-ipi-x24rk-cos
INFO Deleted COS instance syasuda-ocp-ipi-x24rk-image-registry
INFO Skipping deletion of user-provided resource group Default
INFO Deleted DNS record "api-int.syasuda-ocp-ipi.cisxxxxxxxx.com"
INFO Deleted DNS record "api.syasuda-ocp-ipi.cisxxxxxxxx.com"
INFO Deleted DNS record "*.apps.syasuda-ocp-ipi.cisxxxxxxxx.com"
INFO Time elapsed: 8m45s
INFO Uninstallation complete!
```


リソース削除の確認

```txt:VSI
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud is instances |grep -e ID -e syasuda-ocp-ip
ID                                          Name                                                Status    Reserved IP    Floating IP       Profile    Image                                              VPC                Zone       Resource group
```
```txt:Load Balancer
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud is load-balancers | grep -e ID -e syasuda-ocp-ipi
ID                                          Name                                                         Family              Subnets                                             Is public   Provision status   Operating status   Resource group
```
```txt:Security Group
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud is security-groups|grep -e ID -e syasuda-ocp-ipi
ID                                          Name                                             Rules   Targets   VPC                Resource group
```
```txt:その他リソース
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud resource service-instances | grep -e Location -e syasuda-ocp-ipi
Name                                                                                                    Location   State    Type               Resource Group ID
```
```txt:CIS(DNS)
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud cis domains
Listing domains for service instance 'CIS-Enterprise-Usage1' ...
OK
ID                                 Name                  Status   Paused   Type
5f94c1214644097571c114f70bcda563   cisxxxxxxxx.com       active   false    full
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud cis dns-records 5f94c1214644097571c114f70bcda563 | grep -e ID -e syasuda-ocp-ipi
ID                                 Name                                  Type    Content
```

# 3. Service IDの削除

まだこの段階ではService IDまでは削除されていない。

```txt:Service ID
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud iam service-ids|grep 2023-05-25
ServiceId-46a06cf1-36af-4d54-ba40-a6be89a1a274   syasuda-ocp-ipi-openshift-cloud-controller-manager-ibm-cloud-credentials                                                              2023-05-25T13:56+0000   2023-05-25T13:56+0000                                                                                                                                                                                                                     false
ServiceId-67277f0b-f4a4-4641-b6b9-c4ebe6cab2e5   syasuda-ocp-ipi-openshift-cluster-csi-drivers-ibm-cloud-credentials                                                                   2023-05-25T13:56+0000   2023-05-25T13:56+0000                                                                                                                                                                                                                     false
ServiceId-bd82f410-f65b-479a-9872-de0228c4fb69   syasuda-ocp-ipi-openshift-image-registry-installer-cloud-credentials                                                                  2023-05-25T13:56+0000   2023-05-25T13:56+0000                                                                                                                                                                                                                     false
ServiceId-029cca37-50a9-4a91-ad10-33f2074fd691   syasuda-ocp-ipi-openshift-ingress-operator-cloud-credentials                                                                          2023-05-25T13:56+0000   2023-05-25T13:56+0000                                                                                                                                                                                                                     false
ServiceId-2d61c8dc-6ad6-40f3-b576-59fc1679ad5e   syasuda-ocp-ipi-openshift-machine-api-ibmcloud-credentials                                                                            2023-05-25T13:56+0000   2023-05-25T13:56+0000
```


```txt:
[root@new-syasuda-tok1-vpc1 ~]# ./ccoctl ibmcloud delete-service-id --credentials-requests-dir ocp4-ipi-credential --name syasuda-ocp-ipi
2023/10/05 11:16:15 Deleting the service account with name: syasuda-ocp-ipi-openshift-cloud-controller-manager-ibm-cloud-credentials
2023/10/05 11:16:15 deleting the ServiceID with name: syasuda-ocp-ipi-openshift-cloud-controller-manager-ibm-cloud-credentials, ID: ServiceId-46a06cf1-36af-4d54-ba40-a6be89a1a274
2023/10/05 11:16:15 Deleting the service account with name: syasuda-ocp-ipi-openshift-machine-api-ibmcloud-credentials
2023/10/05 11:16:16 deleting the ServiceID with name: syasuda-ocp-ipi-openshift-machine-api-ibmcloud-credentials, ID: ServiceId-2d61c8dc-6ad6-40f3-b576-59fc1679ad5e
2023/10/05 11:16:16 Deleting the service account with name: syasuda-ocp-ipi-openshift-image-registry-installer-cloud-credentials
2023/10/05 11:16:16 deleting the ServiceID with name: syasuda-ocp-ipi-openshift-image-registry-installer-cloud-credentials, ID: ServiceId-bd82f410-f65b-479a-9872-de0228c4fb69
2023/10/05 11:16:16 Deleting the service account with name: syasuda-ocp-ipi-openshift-ingress-operator-cloud-credentials
2023/10/05 11:16:16 deleting the ServiceID with name: syasuda-ocp-ipi-openshift-ingress-operator-cloud-credentials, ID: ServiceId-029cca37-50a9-4a91-ad10-33f2074fd691
2023/10/05 11:16:17 Deleting the service account with name: syasuda-ocp-ipi-openshift-cluster-csi-drivers-ibm-cloud-credentials
2023/10/05 11:16:17 deleting the ServiceID with name: syasuda-ocp-ipi-openshift-cluster-csi-drivers-ibm-cloud-credentials, ID: ServiceId-67277f0b-f4a4-4641-b6b9-c4ebe6cab2e5
```

```txt:Service ID
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud iam service-ids|grep 2023-05-25
（出力なし）
```

# 4. OpenShift Cluster Manager Hybrid Cloud Consoleでアーカイブ

[OpenShift Cluster Manager Hybrid Cloud Console](https://console.redhat.com/openshift)にログインし、このClusterをアーカイブする（そもそも評価版ライセンスが切れていた・・・）。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/07e187c5-e1d2-3e67-50bd-7f328d9ff6c4.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/ece2c9c8-34f8-0319-6c73-b157e28be41f.png)