Removing API Connect
You can remove all parts of the API Connect deployment on Kubernetes.
About this task
These instructions completely remove API Connect, including PVCs and secrets.
- To delete the API Connect deployment in a Kubernetes runtime environment, you must use the Kubernetes command-line tool, kubectl.
- You must run the commands in the order shown in the procedure on this page. If you run commands out of order, you might encounter a problem where the deletion of namespaces hangs.
- If you want to retain the PVCs, which contain some of the data you built up when using the application, you must also keep the associated secret used to decrypt the data. To do this, you must backup each subsystem, and then uninstall the subsystems individually. In this case, do not use the instructions on this page. Instead, see Uninstalling API Connect subsystems.
Procedure
-
Delete all API Connect systems.
kubectl delete apic --all -n <namespace>
This command is the equivalent of deleting each of the individual subsystems one at a time, and also deleting all of their backup and restore CRs. The commands that run during this step are:
- Subsystem CRs. For
example:
kubectl delete mgmt --all -n <namespace> kubectl delete a7s --all -n <namespace> kubectl delete ptl --all -n <namespace> kubectl delete gwv6 --all -n <namespace>
- Backup and restore
CRs:
kubectl delete Backup --all -n <namespace> kubectl delete mgmtr --all -n <namespace> kubectl delete pb --all -n <namespace> kubectl delete pr --all -n <namespace> kubectl delete a7b --all -n <namespace> kubectl delete a7r --all -n <namespace>
Note: If your deployment was previously on V10.0.6.0 or earlier, delete any pre-V10.0.7.0 management backup or restore CRs:kubectl delete mgmtb --all -n <namespace> kubectl delete mgmtr --all -n <namespace>
- Subsystem CRs. For
example:
- Delete the Operator deployments.
kubectl delete deployment datapower-operator ibm-apiconnect -n <namespace>
- Delete all Service Accounts in the namespace. Important:
If your deployment uses default namespaces be cautious when using
kubectl delete <entity> --all
commands. There can be other pods, services, and more in the default namespace. When using the default namespace, keep in mind that usingkubernetes delete <entity> --all
, where <entity
> can delete non-APIC entities, such assa
(Service Accounts),secrets
,rolebindings
, etc.kubectl delete sa --all -n <namespace>
- Delete all Secrets in the namespace.
kubectl delete secrets --all -n <namespace>
- Delete all Rolebindings in the namespace.
kubectl delete rolebindings --all -n <namespace>
- Delete all Roles in the namespace.
kubectl delete roles --all -n <namespace>
- Clean up any remaining jobs.
kubectl delete jobs --all -n <namespace>
- Delete all PVCs in the namespace.
kubectl delete pvc --all -n <namespace>
- Delete Issuers in the namespace.
Note that there might be none found.
kubectl delete issuer --all -n <namespace>
- Delete certificates in the namespace.
Note that there might be none found.
kubectl delete certificates --all -n <namespace>
- If you are not using the default namespace, delete the Namespace Important: If your deployment uses the default namespace, do not delete it. There can be other pods, services, and more in the default namespace.
kubectl delete ns <namespace>
- Delete
validatingwebhookconfiguration
-
kubectl get validatingwebhookconfiguration | awk /<ns>/'{print $1}' | xargs kubectl delete validatingwebhookconfiguration
-
kubectl delete validatingwebhookconfiguration managements.validator.subsystem.apiconnect.ibm.com
-
- Delete
mutatingwebhookconfiguration
-
kubectl get mutatingwebhookconfiguration | awk /$NS/'{print $1}' | xargs kubectl delete mutatingwebhookconfiguration
-
kubectl get mutatingwebhookconfiguration | awk /apicop-management-defaulter/'{print $1}' | xargs kubectl delete mutatingwebhookconfiguration
-
- Delete the Apiconnect CRDs (custom resource definitions)
kubectl delete crd analyticsbackups.analytics.apiconnect.ibm.com kubectl delete crd analyticsclusters.analytics.apiconnect.ibm.com kubectl delete crd analyticsrestores.analytics.apiconnect.ibm.com kubectl delete crd datapowerservices.datapower.ibm.com kubectl delete crd gatewayclusters.gateway.apiconnect.ibm.com kubectl delete crd backups.management.apiconnect.ibm.com kubectl delete crd managementclusters.management.apiconnect.ibm.com kubectl delete crd managementrestores.management.apiconnect.ibm.com kubectl delete crd natsclusters.nats.io kubectl delete crd natsserviceroles.nats.io kubectl delete crd natsstreamingclusters.streaming.nats.io kubectl delete crd portalbackups.portal.apiconnect.ibm.com kubectl delete crd portalclusters.portal.apiconnect.ibm.com kubectl delete crd portalrestores.portal.apiconnect.ibm.com
Note: If your deployment was previously on V10.0.6.0 or earlier, delete any pre-V10.0.7.0 management backup or restore CRs:kubectl delete crd managementbackups.management.apiconnect.ibm.com
- Delete EDB CRDs:
- Get a list of the EDB CRDs:
kubectl -n <namespace> get crds | grep enterprisedb
Expected output:backups.postgresql.k8s.enterprisedb.io 2023-07-26T14:09:51Z clusters.postgresql.k8s.enterprisedb.io 2023-07-26T14:09:51Z poolers.postgresql.k8s.enterprisedb.io 2023-07-26T14:09:59Z scheduledbackups.postgresql.k8s.enterprisedb.io 2023-07-26T14:10:02Z
- Delete the EDB
CRDs:
where <crd name> is the name of each CRD output in step 15.a.kubectl -n <namespace> delete crd <crd name>
- Get a list of the EDB CRDs:
- If you installed cert-manager and want to remove it now, complete the following
steps: Warning: If you are using shared clusters for API Connect with a common cert manager, be aware that this step removes the components of the cert manager from cluster wide scope.
- Delete the cert-manager
kubectl delete deploy --all -n cert-manager kubectl delete service --all -n cert-manager kubectl delete sa -n cert-manager --all kubectl delete secrets -n cert-manager --all kubectl delete APIService v1beta1.webhook.cert-manager.io -n cert-manager kubectl delete MutatingWebhookConfiguration cert-manager-webhook -n cert-manager kubectl delete ValidatingWebhookConfiguration cert-manager-webhook -n cert-manager kubectl delete ns cert-manager
- Delete cert-manager CRDs
- Delete the cert-manager CRDs with the
following:
kubectl delete crd issuers.cert-manager.io kubectl delete crd certificaterequests.cert-manager.io kubectl delete crd certificates.cert-manager.io kubectl delete crd challenges.cert-manager.io kubectl delete crd clusterissuers.cert-manager.io kubectl delete crd orders.cert-manager.io
-
Older API Connects versions may have cert-manager CRDs from an older version of cert-manager which had a different name, delete these CRDs with the following:
kubectl delete crd certificaterequests.certmanager.k8s.io kubectl delete crd certificates.certmanager.k8s.io kubectl delete crd challenges.acme.certmanager.k8s.io kubectl delete crd clusterissuers.certmanager.k8s.io kubectl delete crd issuers.certmanager.k8s.io kubectl delete crd orders.acme.certmanager.k8s.io
- Delete the cert-manager CRDs with the
following:
- Delete the cert-manager