Delete your stateful workloads using standard Kubernetes deletion methodologies.
Before you begin
To complete the tasks in this document, you must request the necessary permissions and prepare your environment.
Request IAM roles
To create, delete, edit, or view stateful workloads in a Kubernetes cluster, ask
your Organization IAM Admin to grant you the Namespace Admin
(namespace-admin) role. This role is bound to your project namespace.
Prepare your environment
To run commands against the pre-configured bare metal Kubernetes cluster, make sure you have the following resources:
Locate the Kubernetes cluster name, or ask your Platform Administrator what the cluster name is.
Sign in and generate the kubeconfig file for the Kubernetes cluster if you don't have one.
Use the kubeconfig path of the Kubernetes cluster to replace
CLUSTER_KUBECONFIGin these instructions.
Delete a StatefulSet resource
Delete a StatefulSet resource if you no longer have a use for its associated
stateful container workloads.
To delete a
StatefulSetresource, run:kubectl --kubeconfig CLUSTER_KUBECONFIG \ -n NAMESPACE \ delete statefulset STATEFULSET_NAMEReplace the following:
CLUSTER_KUBECONFIG: the kubeconfig file for the Kubernetes cluster.NAMESPACE: the project namespace of the container workload.STATEFULSET_NAME: the name of theStatefulSetobject to delete.
When deleting a
StatefulSetresource, all of its pods are also deleted. If you prefer to only delete theStatefulSetresource and not its pods, include the--cascade=orphanparameter.Delete the associated service:
kubectl --kubeconfig CLUSTER_KUBECONFIG \ delete service SERVICE_NAMEReplace the following variables:
CLUSTER_KUBECONFIG: the kubeconfig file for the Kubernetes cluster.SERVICE_NAME: the name of theServiceobject to delete.