Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Elimina i carichi di lavoro stateful utilizzando le metodologie di eliminazione standard di Kubernetes.
Prima di iniziare
Per eseguire comandi su un cluster Kubernetes, assicurati di disporre delle seguenti risorse:
Individua il nome del cluster o chiedi all'amministratore della piattaforma qual è il
nome del cluster.
Accedi e genera il file kubeconfig per il cluster Kubernetes se non ne hai uno.
Utilizza il percorso kubeconfig del cluster Kubernetes per sostituire
KUBERNETES_CLUSTER_KUBECONFIG in queste istruzioni.
Per ottenere le autorizzazioni necessarie per eliminare i carichi di lavoro stateful, chiedi all'amministratore IAM dell'organizzazione di concederti il ruolo Amministratore spazio dei nomi (namespace-admin) nello spazio dei nomi del progetto.
Elimina una risorsa StatefulSet
Elimina una risorsa StatefulSet se non hai più bisogno dei relativi
carichi di lavoro dei container stateful.
CLUSTER_KUBECONFIG: il file kubeconfig per il cluster Kubernetes.
NAMESPACE: lo spazio dei nomi del progetto del
carico di lavoro del container.
STATEFULSET_NAME: il nome dell'oggetto StatefulSet
da eliminare.
Quando elimini una risorsa StatefulSet, vengono eliminati anche tutti i relativi pod. Se
preferisci eliminare solo la risorsa StatefulSet e non i relativi pod,
includi il parametro --cascade=orphan.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThis document explains how to delete stateful workloads, specifically \u003ccode\u003eStatefulSet\u003c/code\u003e resources, in a Kubernetes user cluster using standard deletion methods.\u003c/p\u003e\n"],["\u003cp\u003eBefore deleting any resources, you need to locate the user cluster name, have the correct kubeconfig file, and have Namespace Admin permissions granted by your Organization IAM Admin.\u003c/p\u003e\n"],["\u003cp\u003eTo delete a \u003ccode\u003eStatefulSet\u003c/code\u003e, use the \u003ccode\u003ekubectl delete statefulset STATEFULSET_NAME\u003c/code\u003e command, where \u003ccode\u003eSTATEFULSET_NAME\u003c/code\u003e is the name of the \u003ccode\u003eStatefulSet\u003c/code\u003e to be deleted.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a \u003ccode\u003eStatefulSet\u003c/code\u003e also deletes its associated pods by default; however, you can use the \u003ccode\u003e--cascade=orphan\u003c/code\u003e parameter to only delete the \u003ccode\u003eStatefulSet\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eAfter deleting the \u003ccode\u003eStatefulSet\u003c/code\u003e, you must also delete the associated service using the \u003ccode\u003ekubectl delete service SERVICE_NAME\u003c/code\u003e command, where \u003ccode\u003eSERVICE_NAME\u003c/code\u003e is the name of the service to be deleted.\u003c/p\u003e\n"]]],[],null,["# Delete stateful workloads\n\nDelete your stateful workloads using standard Kubernetes deletion methodologies.\n\nBefore you begin\n----------------\n\nTo run commands against a Kubernetes cluster, ensure you have the following resources:\n\n1. Locate the cluster name, or ask your Platform Administrator what the\n cluster name is.\n\n2. [Sign in and generate](/distributed-cloud/hosted/docs/latest/appliance/application/ao-user/iam/sign-in#cli) the\n kubeconfig file for the Kubernetes cluster if you don't have one.\n\n3. Use the kubeconfig path of the Kubernetes cluster to replace\n \u003cvar translate=\"no\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e in these instructions.\n\nTo get the required permissions to delete stateful workloads, ask your\nOrganization IAM Admin to grant you the Namespace Admin role (`namespace-admin`)\nin your project namespace.\n\nDelete a `StatefulSet` resource\n-------------------------------\n\nDelete a `StatefulSet` resource if you no longer have a use for its associated\nstateful container workloads.\n\n1. To delete a `StatefulSet` resource, run:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e \\\n -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e \\\n delete statefulset \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the Kubernetes cluster.\n\n - \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e: the project namespace of the\n container workload.\n\n - \u003cvar translate=\"no\"\u003eSTATEFULSET_NAME\u003c/var\u003e: the name of the `StatefulSet`\n object to delete.\n\n When deleting a `StatefulSet` resource, all of its pods are also deleted. If\n you prefer to only delete the `StatefulSet` resource and not its pods,\n include the `--cascade=orphan` parameter.\n2. Delete the associated service:\n\n kubectl --kubeconfig \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e \\\n delete service \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e\n\n Replace the following variables:\n - \u003cvar translate=\"no\"\u003eCLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the Kubernetes cluster.\n\n - \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e: the name of the `Service` object to\n delete."]]