Delete your stateful workloads using standard Kubernetes deletion methodologies.
Before you begin
To run commands against a Kubernetes cluster, ensure 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
KUBERNETES_CLUSTER_KUBECONFIG
in these instructions.
To get the required permissions to delete stateful workloads, ask your
Organization IAM Admin to grant you the Namespace Admin role (namespace-admin
)
in your project namespace.
Delete a StatefulSet
resource
Delete a StatefulSet
resource if you no longer have a use for its associated
stateful container workloads.
To delete a
StatefulSet
resource, run:kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \ -n NAMESPACE \ delete statefulset STATEFULSET_NAME
Replace the following:
KUBERNETES_CLUSTER_KUBECONFIG
: the kubeconfig file for the cluster.NAMESPACE
: the project namespace of the container workload.STATEFULSET_NAME
: the name of theStatefulSet
object to delete.
When deleting a
StatefulSet
resource, all of its pods are also deleted. If you prefer to only delete theStatefulSet
resource and not its pods, include the--cascade=orphan
parameter.Delete the associated service:
kubectl --kubeconfig KUBERNETES_CLUSTER_KUBECONFIG \ delete service SERVICE_NAME
Replace the following variables:
KUBERNETES_CLUSTER_KUBECONFIG
: the kubeconfig file for the cluster.SERVICE_NAME
: the name of theService
object to delete.