karmada icon indicating copy to clipboard operation
karmada copied to clipboard

karmada member cluster status Unknown

Open yanlingsishao opened this issue 3 years ago • 13 comments

有没有什么正确姿势删除成员cluster 我通过命令删除的时候,会长时间卡在delete哪里 如果我用接口的方式,有可能一段时间它就自动删除了,我昨天刚删的一个操作,现在都没有删掉

yanlingsishao avatar Nov 26 '21 02:11 yanlingsishao

请问你用的哪个版本?

删除命令执行时显示什么?

我昨天刚删的一个操作,现在都没有删掉

有可能的话提供一下karmada-controller-manager的日志?

RainbowMango avatar Nov 26 '21 02:11 RainbowMango

@RainbowMango v0.8.0

如下图,会一直卡在这里 image

karmada-controller-manager log

I1126 02:33:59.426742       1 cluster_controller.go:374] cluster 1658a712-53d2-409f-97ca-4a6ccc1a1dab hasn't been updated for 17h24m17.612795895s. Last Ready is: &Condition{Type:Ready,Status:Unknown,ObservedGeneration:0,LastTransitionTime:2021-11-25 09:10:21 +0000 UTC,Reason:ClusterStatusUnknown,Message:Cluster status controller stopped posting cluster status.,}
I1126 02:33:59.974037       1 reflector.go:530] k8s.io/client-go/dynamic/dynamicinformer/informer.go:91: Watch close - *unstructured.Unstructured total 0 items received
I1126 02:34:01.341297       1 reflector.go:530] k8s.io/client-go/dynamic/dynamicinformer/informer.go:91: Watch close - *unstructured.Unstructured total 0 items received
I1126 02:34:04.428048       1 cluster_controller.go:374] cluster 1658a712-53d2-409f-97ca-4a6ccc1a1dab hasn't been updated for 17h24m22.614102247s. Last Ready is: &Condition{Type:Ready,Status:Unknown,ObservedGeneration:0,LastTransitionTime:2021-11-25 09:10:21 +0000 UTC,Reason:ClusterStatusUnknown,Message:Cluster status controller stopped posting cluster status.,}
I1126 02:34:08.392798       1 reflector.go:530] k8s.io/client-go/dynamic/dynamicinformer/informer.go:91: Watch close - *unstructured.Unstructured total 0 items received
I1126 02:34:09.428592       1 cluster_controller.go:374] cluster 1658a712-53d2-409f-97ca-4a6ccc1a1dab hasn't been updated for 17h24m27.614645921s. Last Ready is: &Condition{Type:Ready,Status:Unknown,ObservedGeneration:0,LastTransitionTime:2021-11-25 09:10:21 +0000 UTC,Reason:ClusterStatusUnknown,Message:Cluster status controller stopped posting cluster status.,}
I1126 02:34:14.429123       1 cluster_controller.go:374] cluster 1658a712-53d2-409f-97ca-4a6ccc1a1dab hasn't been updated for 17h24m32.61515452s. Last Ready is: &Condition{Type:Ready,Status:Unknown,ObservedGeneration:0,LastTransitionTime:2021-11-25 09:10:21 +0000 UTC,Reason:ClusterStatusUnknown,Message:Cluster status controller stopped posting cluster status.,}

yanlingsishao avatar Nov 26 '21 02:11 yanlingsishao

I1126 02:33:58.542682       1 reflector.go:530] sigs.k8s.io/controller-runtime/pkg/cac/informers_map.go:245: Watch close - *v1alpha1.Cluster total 0 items received
I1126 02:33:59.426742       1 cluster_controller.go:374] cluster 1658a712-53d2-409f-971dab hasn't been updated for 17h24m17.612795895s. Last Ready is: &Condition{Type:Readynown,ObservedGeneration:0,LastTransitionTime:2021-11-25 09:10:21 +0000 UTC,Reason:Clus
I1126 02:34:14.461490       1 reflector.go:530] sigs.k8s.io/controller-runtime/pkg/cache/internal/informers_map.go:245: Watch close - *v1alpha1.PropagationPolicy total 0 items received
I1126 02:34:14.783012       1 reflector.go:255] Listing and watching *unstructured.Unstructured from k8s.io/client-go/dynamic/dynamicinformer/informer.go:91
E1126 02:34:14.786392       1 reflector.go:138] k8s.io/client-go/dynamic/dynamicinformer/informer.go:91: Failed to watch *unstructured.Unstructured: failed to list *unstructured.Unstructured: nodes is forbidden: User "system:serviceaccount:default:default" cannot list resource "nodes" in API group "" at the cluster scope
I1126 02:34:19.430222       1 cluster_controller.go:374] cluster 1658a712-53d2-409f-97ca-4a6ccc1a1dab hasn't been updated for 17h24m37.616274425s. Last Ready is: &Condition{Type:Ready,Status:Unknown,ObservedGeneration:0,LastTransitionTime:2021-11-25 09:10:21 +0000 UTC,Reason:ClusterStatusUnknown,Message:Cluster status controller stopped posting cluster status.,}
I1126 02:34:20.380458       1 reflector.go:530] k8s.io/client-go/dynamic/dynamicinformer/informer.go:91: Watch close - *unstructured.Unstructured total 0 items received
I1126 02:34:20.517639       1 reflector.go:255] Listing and watching *unstructured.Unstructured from k8s.io/client-go/dynamic/dynamicinformer/informer.go:91

yanlingsishao avatar Nov 26 '21 02:11 yanlingsishao

不应该使用kubectl来直接删除集群,应该使用kubectl karmada unjoin命令:

# kubectl karmada unjoin --help 
Unjoin removes the registration of a cluster from control plane.

Usage:
  karmada unjoin CLUSTER_NAME --cluster-kubeconfig=<KUBECONFIG> [flags]

Examples:

# Unjoin cluster from karamada control plane
kubectl karmada unjoin CLUSTER_NAME --cluster-kubeconfig=<KUBECONFIG>

# Unjoin cluster from karamada control plane with timeout
kubectl karmada unjoin CLUSTER_NAME --cluster-kubeconfig=<KUBECONFIG> --wait 2m

RainbowMango avatar Nov 26 '21 02:11 RainbowMango

哦,那我需要通过unjoin那块代码去实现,而不能直接delete

yanlingsishao avatar Nov 26 '21 02:11 yanlingsishao

我的agent方式是Pull,并不会依赖到karmadactl,也必须用这种方式剔除么

yanlingsishao avatar Nov 26 '21 02:11 yanlingsishao

@lfbear @lonelyCZ 两位可以给点意见

RainbowMango avatar Nov 26 '21 02:11 RainbowMango

我的agent方式是Pull,并不会依赖到karmadactl,也必须用这种方式剔除么

删除karmada控制面上的cluster,用karmadactl unjoin是比较安全的,pull模式的也需要通过这个命令来删除控制面上的cluster对象。可以直接通过karmadactl unjoin <cluster_name>来删除,不用带后面的--cluster-kubeconfig

lonelyCZ avatar Nov 26 '21 03:11 lonelyCZ

@lonelyCZ 我使用 unjoin 过了一段时间后,显示超时 image

yanlingsishao avatar Nov 28 '21 08:11 yanlingsishao

谢谢反馈,@yanlingsishao

如果k8s中某个资源用kubectl delete都删不掉的话,可以查看一个这个资源的finalizers字段是否为空,如果不为空的话可以用kubectl edit手动清空掉试试。

Cluster的状态为Unknown的话,可以重启一下karmada-controller-managerkarmada-agent试试。

推荐用karmada最新版本,功能更丰富。

lonelyCZ avatar Nov 28 '21 08:11 lonelyCZ

unjoin 可用吗? 也遇到相同问题

zhoulouzi avatar Sep 19 '22 07:09 zhoulouzi

@zhoulouzi 你现在用的什么版本,执行了具体什么操作,出现了什么非预期的现象?

RainbowMango avatar Sep 19 '22 10:09 RainbowMango

unjoin 可用吗? 也遇到相同问题

对于PULL模式的子集群,如果状态为Unknown, 这时候必须要手动把所有分发给该集群的Work资源先删掉(通过kubectl edit每个Work,删掉以下内容)

finalizers:
  - karmada.io/execution-controller

lonelyCZ avatar Sep 19 '22 12:09 lonelyCZ

/close

RainbowMango avatar Feb 09 '23 08:02 RainbowMango

@RainbowMango: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

karmada-bot avatar Feb 09 '23 08:02 karmada-bot