이 페이지에서는 Terminating 상태로 멈춘 네임스페이스 문제를 해결하는 방법을 보여줍니다.
네임스페이스는 네임스페이스 내에 하나 이상의 리소스가 존재할 때 Kubernetes 파이널라이저를 사용하여 삭제를 방지합니다.
kubectl delete 명령어를 사용하여 네임스페이스를 삭제하면 네임스페이스가 Terminating 상태로 전환됩니다.
Kubernetes가 종속 리소스를 삭제하고 모든 파이널라이저를 지울 때까지 네임스페이스는 Terminating 상태로 유지됩니다. 네임스페이스 수명 주기 컨트롤러는 먼저 GKE가 삭제해야 하는 네임스페이스의 모든 리소스를 나열합니다.
GKE가 종속 리소스를 삭제할 수 없거나 네임스페이스 수명 주기 컨트롤러가 네임스페이스가 비어 있는지 확인할 수 없으면 사용자가 문제를 해결할 때까지 네임스페이스가 Terminating 상태로 유지됩니다.
Terminating 상태로 멈춘 네임스페이스를 해결하려면 삭제를 차단하는 비정상 구성요소를 식별하고 이를 삭제합니다. 다음 해결 방법을 차례로 시도해 보세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Troubleshoot namespace stuck in the Terminating state\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page shows you how to resolve issues with a namespace stuck in the\n`Terminating` state.\n\nNamespaces use Kubernetes [finalizers](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#finalizers)\nto prevent deletion if one or more resources within a namespace still exist.\nWhen you delete a namespace using the `kubectl delete` command, the namespace\nenters the `Terminating` state.\nThe namespace stays in the `Terminating` state\nuntil Kubernetes deletes its dependent resources\nand clears all finalizers. The namespace lifecycle controller first lists all\nresources in the namespace that GKE needs to delete.\n\nIf GKE can't delete a dependent resource,\nor if the namespace\nlifecycle controller can't verify that the namespace is empty, then the namespace\nremains in the `Terminating` state until you resolve the issue.\n\nTo resolve a namespace stuck in the `Terminating` state, identify\nand remove any unhealthy components blocking the deletion. Try these solutions\nin order:\n\n1. [Find and remove unavailable API services](#unavailable-api-services).\n2. [Find and remove remaining resources](#remove_resource).\n3. [Force delete the namespace](#force-delete-namespace).\n\nFind and remove unavailable API services\n----------------------------------------\n\n1. List unavailable API services:\n\n kubectl get apiservice | grep False\n\n2. Troubleshoot any unresponsive services:\n\n kubectl describe apiservice \u003cvar translate=\"no\"\u003eAPI_SERVICE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eAPI_SERVICE\u003c/var\u003e with the name of the unresponsive\n service.\n3. Check if the status of the namespace is still `Terminating`:\n\n kubectl get ns | grep Terminating\n\nFind and remove remaining resources\n-----------------------------------\n\n1. List all the resources remaining in the terminating namespace:\n\n kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e with the name of the namespace you\n want to delete.\n2. Remove any resources displayed in the output.\n\n3. Check if the status of the namespace is still `Terminating`:\n\n kubectl get ns | grep Terminating\n\nForce delete the namespace\n--------------------------\n\n| **Caution:** Use the solution in this section only as a last resort if the previous solutions don't work. Force deleting a namespace could result in resources remaining in your cluster that you can't access.\n\nRemove the finalizers blocking namespace deletion to force the namespace\nto terminate:\n\n1. Save the namespace manifest as a YAML file:\n\n kubectl get ns \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e -o yaml \u003e ns-terminating.yml\n\n2. Open the manifest in a text editor and remove all values in the\n `spec.finalizers` field:\n\n vi ns-terminating.yml\n\n3. Verify that the finalizers field is empty:\n\n cat ns-terminating.yml\n\n The output should look similar to the following: \n\n apiVersion: v1\n kind: Namespace\n metadata:\n annotations:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE\u003c/span\u003e\u003c/var\u003e\n spec:\n finalizers:\n status:\n phase: Terminating\n\n4. Start an HTTP proxy to access the Kubernetes API:\n\n kubectl proxy\n\n5. Replace the namespace manifest using `curl`:\n\n curl -H \"Content-Type: application/yaml\" -X PUT --data-binary @ns-terminating.yml http://127.0.0.1:8001/api/v1/namespaces/\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e/finalize\n\n6. Check if the status of the namespace is still `Terminating`:\n\n kubectl get ns | grep Terminating\n\nWhat's next\n-----------\n\n- If you can't find a solution to your problem in the documentation, see\n [Get support](/kubernetes-engine/docs/getting-support) for further help,\n including advice on the following topics:\n\n - Opening a support case by contacting [Cloud Customer Care](/support-hub).\n - Getting support from the community by [asking questions on StackOverflow](http://stackoverflow.com/questions/tagged/google-kubernetes-engine) and using the `google-kubernetes-engine` tag to search for similar issues. You can also join the [`#kubernetes-engine` Slack channel](https://googlecloud-community.slack.com/messages/C0B9GKTKJ/) for more community support.\n - Opening bugs or feature requests by using the [public issue tracker](/support/docs/issue-trackers)."]]