Removing API Connect on Kubernetes
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 on Kubernetes.
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 mgmtb --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>
- 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 managementbackups.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
- Delete Crunchy CRDs
kubectl delete crd pgclusters.crunchydata.com kubectl delete crd pgpolicies.crunchydata.com kubectl delete crd pgreplicas.crunchydata.com kubectl delete crd pgtasks.crunchydata.com
- 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.certmanager.k8s.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
commands:
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
- If you are using Cert-Manager V0.10.1, delete the Cert-Manager CRDs with the following
commands:
kubectl delete crd issuers.certmanager.k8s.io kubectl delete crd certificaterequests.certmanager.k8s.io kubectl delete crd certificates.certmanager.k8s.io kubectl delete crd challenges.certmanager.k8s.io kubectl delete crd clusterissuers.certmanager.k8s.io kubectl delete crd orders.certmanager.k8s.io
- If you are using Cert-Manager V0.12 for IBM Kubernetes Services (IKS) installations, delete the
Cert-Manager CRDs with the following
commands:
kubectl delete crd certificaterequests.cert-manager.io kubectl delete crd certificates.cert-manager.io kubectl delete crd challenges.acme.cert-manager.io kubectl delete crd clusterissuers.cert-manager.io kubectl delete crd issuers.cert-manager.io kubectl delete crd orders.acme.cert-manager.io
- Delete the Cert-Manager CRDs with the following
commands:
- Delete the Cert-manager