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

  1. 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>
  2. Delete the Operator deployments.
    kubectl delete deployment datapower-operator ibm-apiconnect -n <namespace>
  3. 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 using kubernetes delete <entity> --all, where <entity> can delete non-APIC entities, such as sa (Service Accounts), secrets, rolebindings, etc.

    kubectl delete sa --all -n <namespace>
  4. Delete all Secrets in the namespace.
    kubectl delete secrets --all -n <namespace>
  5. Delete all Rolebindings in the namespace.
    kubectl delete rolebindings --all -n <namespace>
  6. Delete all Roles in the namespace.
    kubectl delete roles --all -n <namespace>
  7. Clean up any remaining jobs.
    kubectl delete jobs --all -n <namespace>
  8. Delete all PVCs in the namespace.
    kubectl delete pvc --all -n <namespace>
  9. Delete Issuers in the namespace.

    Note that there might be none found.

    kubectl delete issuer --all -n <namespace>
  10. Delete certificates in the namespace.

    Note that there might be none found.

    kubectl delete certificates --all -n <namespace>
  11. 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>
  12. Delete validatingwebhookconfiguration
    1. kubectl get validatingwebhookconfiguration | awk /<ns>/'{print $1}' | xargs kubectl delete validatingwebhookconfiguration
    2. kubectl delete validatingwebhookconfiguration managements.validator.subsystem.apiconnect.ibm.com
  13. Delete mutatingwebhookconfiguration
    1. kubectl get mutatingwebhookconfiguration | awk /$NS/'{print $1}' | xargs kubectl delete mutatingwebhookconfiguration
    2. kubectl get mutatingwebhookconfiguration | awk /apicop-management-defaulter/'{print $1}' | xargs kubectl delete mutatingwebhookconfiguration
  14. 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 
  15. Delete EDB CRDs:
    1. 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
    2. Delete the EDB CRDs:
      kubectl -n <namespace> delete crd <crd name>
      where <crd name> is the name of each CRD output in step 15.a.
  16. 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.
    1. 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
    2. 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