Skip to main content
Version: 1.2.0

Delete Slices

This topic provides a cohesive explanation of the steps required to remove a slice from a cluster configuration. To begin with, the namespaces associated with the slice need to be offboarded. The process of offboarding is simple and straightforward, and this topic provides the steps to do so before deleting the slice. However, if the application is installed on multiple clusters within a slice, it is important to note that the offboarding steps must be completed for each cluster.

Delete Namespaces Quotas

You cannot offboard a namespace that has quotas enforced on it. You must delete the quotas enforced on the namespace to offboard it from the slice.

To delete namespace quotas from your configuration:

  1. Open the slice-resource-configuration.yaml file.
  2. Locate the namespace quotas you wish to delete.
  3. Delete the relevant section of the YAML file related to the quotas.
  4. Save the changes to the file.
  5. Apply the updated YAML file to refresh the configuration.

Delete the ServiceExport for Each Application

If a ServiceExport was created in the application namespace, it must be deleted first.

Deleting the ServiceExport removes the corresponding ServiceImport automatically on all the clusters of the slice.

The below variables are required to delete the service export.

VariablesDescription
<cluster name>The name of the cluster the application is deployed on.
<service export name>The name of the service export that you want to delete.
<namespace>The namespace the application is deployed on.

Switch the contexts to the cluster you deployed the application on:

kubectx <cluster name>

Use the following command to delete the ServiceExport from the cluster:

kubectl delete serviceexport <serviceexport name> -n <application namespace>

Offboard Namespaces from the Slice Configuration

To offboard the namespace from a slice, delete the namespace and the associated clusters under the applicationNamespaces in the slice configuration file as illustrated below.

  namespaceIsolationProfile:
applicationNamespaces:
- namespace: iperf
clusters:
- '*'
- namespace: bookinfo
clusters:
- '*'

For example, in the above slice configuration YAML file, if you want to offboard the BookInfo namespace from all clusters, edit the slice configuration YAML file and remove it from applicationNamespaces as illustrated below.

namespaceIsolationProfile:
applicationNamespaces:
- namespace: iperf
clusters:
- '*'

To delete a slice, you must remove all the namespaces and the corresponding clusters. So, edit the slice configuration YAML file to remove them. After you remove the namespaces and the corresponding clusters, the application namespace configuration looks as illustrated below.

namespaceIsolationProfile:
applicationNamespaces:

Apply the slice configuration YAML to update the offboarded namespaces.

kubectl apply -f <slice configuration>.yaml -n <project namespace>
success

You have successfully offboarded the namespaces from the slice.

Delete the Slice

caution

This step must be completed before uninstalling the Slice Operator. Failing to do so can result in slices and resources not being cleaned up properly.

Switch the context to the controller cluster using the following command:

kubectx <cluster name>

To delete an individual slice, use the following command:

kubectl delete sliceconfig <slice-name> -n kubeslice-<project-name>

To delete all the slices, use the following command:

kubectl delete sliceconfig --all -n kubeslice-<project-name>
success

You have successfully deleted the slice(s).