主节点之一关闭后,多主k8s群集无响应

时间:2019-10-17 01:02:01

标签: kubernetes

我有一个3节点K8s集群,其中所有节点都配置为主服务器和工作服务器。我设置了一个观察者通知程序,以便在删除节点时通知我的客户端。

var sharedInformer = informers.NewSharedInformerFactory(kcv.kubeClient.K8sClient, 0)

// Add watcher for the Node.
kcv.nodeInformer = sharedInformer.Core().V1().Nodes().Informer()
kcv.nodeInformerChan = make(chan struct{})

// Node informer state change handler
kcv.nodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs {
    // When a new node gets created
    AddFunc: func(obj interface{}) {
        kcv.handleAddNode(obj)
    },

    // When a node gets deleted
    DeleteFunc: func(obj interface{}) {
        kcv.handleDeleteNode(obj)
    },
})

// Start the shared informer.
kcv.sharedInformerChan = make(chan struct{})    
sharedInformer.Start(kcv.sharedInformerChan)

// Start the resource (node, pod and namespace) specific informers
kcv.nodeInformer.Run(kcv.nodeInformerChan)
kcv.podInformer.Run(kcv.podInformerChan)
kcv.nsInformer.Run(kcv.nsInformerChan)

现在,我看到了三种不同的行为。

  • 当我“关闭”一个主虚拟机时,我看不到任何 通知到达客户端。我期望借助以上代码得到通知。
  • 在确实关闭了主VM并尝试运行“ kubectl get pods -n myns”之后,我看不到任何Pod列表,并且抛出以下错误。
 kubectl get pods -n myns
 Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get pods)
  • 当我恢复先前关闭的主VM时,群集又恢复正常工作了。我能够列出所有三个主节点的Pod。

kubectl版本信息:

kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.7", GitCommit:"6f482974b76db3f1e0f5d24605a9d1d38fad9a2b", GitTreeState:"clean", BuildDate:"2019-03-25T02:41:57Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.7", GitCommit:"6f482974b76db3f1e0f5d24605a9d1d38fad9a2b", GitTreeState:"clean", BuildDate:"2019-03-25T02:41:57Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}

Docker版本:

Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5

集群信息:

kubectl cluster-info
Kubernetes master is running at https://10.30.8.92:6443
coredns is running at https://10.30.8.92:6443/api/v1/namespaces/kube-system/services/coredns:dns/proxy
kubernetes-dashboard is running at https://10.30.8.92:6443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy

0 个答案:

没有答案