• 카테고리

    질문 & 답변
  • 세부 분야

    데브옵스 · 인프라

  • 해결 여부

    미해결

namespace 삭제가 안되요.

21.02.17 13:22 작성 조회수 846

0

안녕하세요. 좋은 강의 잘 보고 있습니다.

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.10", GitCommit:"62876fc6d93e891aa7fbe19771e6a6c03773b0f7", GitTreeState:"clean", BuildDate:"2020-10-15T01:52:24Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.14", GitCommit:"5de7fd1f9555368a86eb0f8f664dc58055c17269", GitTreeState:"clean", BuildDate:"2021-01-18T09:31:01Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}


Namespace를 삭제하면, Terminating 상태로 삭제가 되지 않습니다.

sansae@dev$ kubectl get ns
NAME              STATUS        AGE
default           Active        21d
dev               Active        47h
ingress-basic     Terminating   7d3h
ingress-nginx     Active        72m
kube-node-lease   Active        21d
kube-public       Active        21d
kube-system       Active        21d

아래 방법으로 시도하였으나, 마찬가지 삭제가 되지 않아요 ㅠㅠ;

$ kubectl get namespace ingress-basic -o json > tmp.json
$ kubectl proxy --prot=8888 &
$ curl -k -H "Content-Type: application/json" -X PUT --data-binary @tmp.json http://127.0.0.1:8888/api/v1/namespaces/ingress-basic/finalize

CURL실행 응답값.

spaces/ingress-basic/finalize
{
  "kind": "Namespace",
  "apiVersion": "v1",
  "metadata": {
    "name": "ingress-basic",
    "selfLink": "/api/v1/namespaces/ingress-basic/finalize",
    "uid": "217b3527-e540-463e-915d-c9eff4c9f07b",
    "resourceVersion": "5775075",
    "creationTimestamp": "2021-02-10T00:16:16Z",
    "deletionTimestamp": "2021-02-17T02:09:50Z",
    "managedFields": [
      {
        "manager": "kubectl",
        "operation": "Update",
        "apiVersion": "v1",
        "time": "2021-02-10T00:16:16Z",
        "fieldsType": "FieldsV1",
        "fieldsV1": {"f:status":{"f:phase":{}}}
      },
      {
        "manager": "kube-controller-manager",
        "operation": "Update",
        "apiVersion": "v1",
        "time": "2021-02-17T02:09:55Z",
        "fieldsType": "FieldsV1",
        "fieldsV1": {"f:status":{"f:conditions":{".":{},"k:{\"type\":\"NamespaceContentRemaining\"}":{".":{},"f:lastTransitionTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"NamespaceDeletionContentFailure\"}":{".":{},"f:lastTransitionTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"NamespaceDeletionDiscoveryFailure\"}":{".":{},"f:lastTransitionTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"NamespaceDeletionGroupVersionParsingFailure\"}":{".":{},"f:lastTransitionTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}},"k:{\"type\":\"NamespaceFinalizersRemaining\"}":{".":{},"f:lastTransitionTime":{},"f:message":{},"f:reason":{},"f:status":{},"f:type":{}}}}}
      }
    ]
  },
  "spec": {
    "finalizers": [
      "kubernetes"
    ]
  },
  "status": {
    "phase": "Terminating",
    "conditions": [
      {
        "type": "NamespaceDeletionDiscoveryFailure",
        "status": "True",
        "lastTransitionTime": "2021-02-17T02:09:55Z",
        "reason": "DiscoveryFailed",
        "message": "Discovery failed for some groups, 1 failing: unable to retrieve the complete list of server APIs: webhook.cert-manager.io/v1beta1: the server is currently unable to handle the request"
      },
      {
        "type": "NamespaceDeletionGroupVersionParsingFailure",
        "status": "False",
        "lastTransitionTime": "2021-02-17T02:09:55Z",
        "reason": "ParsedGroupVersions",
        "message": "All legacy kube types successfully parsed"
      },
      {
        "type": "NamespaceDeletionContentFailure",
        "status": "False",
        "lastTransitionTime": "2021-02-17T02:09:55Z",
        "reason": "ContentDeleted",
        "message": "All content successfully deleted, may be waiting on finalization"
      },
      {
        "type": "NamespaceContentRemaining",
        "status": "False",
        "lastTransitionTime": "2021-02-17T02:09:55Z",
        "reason": "ContentRemoved",
        "message": "All content successfully removed"
      },
      {
        "type": "NamespaceFinalizersRemaining",
        "status": "False",
        "lastTransitionTime": "2021-02-17T02:09:55Z",
        "reason": "ContentHasNoFinalizers",
        "message": "All content-preserving finalizers finished"
      }
    ]
  }
}

답변 1

답변을 작성해보세요.

2

gasbugs님의 프로필

gasbugs

2021.02.21

안녕하세요 강사 최일선입니다.

포드가 정상 종료되지 않는 경우에 네임스페이스가 삭제가 되지 않고 스턱될 수 있습니다.

-f 옵션을 명령에 추가로 사용하시면 포드를 강제로 삭제할 수 있습니다.

kubectl delete pod --all -f -n <네임스페이스>

그럼 네임스페이스가 종료될 것으로 생각됩니다.

다음 내용도 참고해보시면 좋을 듯합니다.

kubernetes - Namespace "stuck" as Terminating, How do I remove it? - Stack Overflow

감사합니다!