Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Hapus workload stateful Anda menggunakan metodologi penghapusan Kubernetes standar.
Sebelum memulai
Untuk menjalankan perintah terhadap
cluster Kubernetes,
pastikan Anda memiliki resource berikut:
Temukan nama cluster Kubernetes, atau tanyakan kepada Administrator Platform Anda nama cluster tersebut.
Login dan buat
file kubeconfig untuk cluster Kubernetes jika Anda belum memilikinya.
Gunakan jalur kubeconfig cluster Kubernetes untuk mengganti
KUBERNETES_CLUSTER_KUBECONFIG dalam petunjuk ini.
Untuk mendapatkan izin yang diperlukan guna menghapus workload stateful, minta Admin IAM Organisasi Anda untuk memberi Anda peran Namespace Admin (namespace-admin) di namespace project Anda.
Menghapus resource StatefulSet
Hapus resource StatefulSet jika Anda tidak lagi menggunakan workload container stateful terkaitnya.
KUBERNETES_CLUSTER_KUBECONFIG: file kubeconfig untuk
cluster.
NAMESPACE: namespace project dari
workload container.
STATEFULSET_NAME: nama objek StatefulSet
yang akan dihapus.
Saat menghapus resource StatefulSet, semua pod-nya juga akan dihapus. Jika
Anda hanya ingin menghapus resource StatefulSet dan bukan pod-nya,
sertakan parameter --cascade=orphan.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eEnsure you have the cluster name and kubeconfig file for the Kubernetes cluster you're working with, as well as the Namespace Admin role.\u003c/p\u003e\n"],["\u003cp\u003eTo delete a \u003ccode\u003eStatefulSet\u003c/code\u003e resource and its associated stateful container workloads, use the \u003ccode\u003ekubectl delete statefulset\u003c/code\u003e command, providing the kubeconfig, namespace, and statefulset name.\u003c/p\u003e\n"],["\u003cp\u003eIf you want to delete the \u003ccode\u003eStatefulSet\u003c/code\u003e resource without deleting its pods, you can include the \u003ccode\u003e--cascade=orphan\u003c/code\u003e parameter in the deletion command.\u003c/p\u003e\n"],["\u003cp\u003eAfter deleting the \u003ccode\u003eStatefulSet\u003c/code\u003e, delete the associated service using the \u003ccode\u003ekubectl delete service\u003c/code\u003e command and providing the relevant kubeconfig and service name.\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\n[Kubernetes cluster](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/clusters#cluster-architecture),\nmake sure you have the following resources:\n\n1. Locate the Kubernetes cluster name, or ask your Platform Administrator what\n the cluster name is.\n\n2. [Sign in and generate](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/iam/sign-in#zonal-cluster-kubeconfig)\n the 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\"\u003eKUBERNETES_CLUSTER_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\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the 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\"\u003eKUBERNETES_CLUSTER_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\"\u003eKUBERNETES_CLUSTER_KUBECONFIG\u003c/var\u003e: the kubeconfig file for\n the cluster.\n\n - \u003cvar translate=\"no\"\u003eSERVICE_NAME\u003c/var\u003e: the name of the `Service` object to\n delete."]]