关于kubernetes:tke-1206升级到1225的一点小插曲

5次阅读

共计 2326 个字符,预计需要花费 6 分钟才能阅读完成。

背景:

线上 tke 集群 1.20.6, 就相当于 kubernetes1.20 版本吧!前几天点了一下降级,降级了 master 节点。依照我的集体了解集群降级会对集群 api 兼容性查看的,通过了降级了没有问题。昨天对集群的节点进行了缩容。而后 pod 进行了从新的调度。问题就来了:
晚期有一个搭建的 eck 集群:TKE1.20.6 搭建 elasticsearch on kubernetes。elastic-operator-0 and kibana 服务都不能失常运行了,logs pod 日志如下:
elastic-operator 日志内容根本是:

unable to setup and fill the webhook certificates","service.version":"1.6.0+8326ca8a","service.type":"eck","ecs.version":"1.4.0","error":"the server could not find the requested resource","error.stack_trace":"github.com/elastic/cloud-on-k8s/cmd/manager.startOperator\n\t/go/src/github.com/elastic/cloud-on-k8s/cmd/manager/main.go:558\ngithub.com/elastic/cloud-on-k8s/cmd/manager.doRun.func2\n\t/go/src/github.com/elastic/cloud-on-k8s/cmd/manager/main.go:328

就截取一下:unable to setup and fill the webhook
kibana 日志如下:

解决过程:

搜索引擎关键词

我能想到的:
kubernetes 1.20 upgrade 1.22 eck unable to setup and fill the webhook certificates

我点的第二个:https://github.com/elastic/cloud-on-k8s/issues/3958
疾速扫一眼看到了:can you give us more information about the kind of cluster your are using (self managed, Azure, EKS…) ? admissionregistration.k8s.io/v1beta1 is supposed to be removed in 1.22 only: kubernetes/kubernetes#82021

根本确定了是 admissionregistration.k8s.io 版本问题!
看一下:

kubectl get validatingwebhookconfiguration
NAME                                    WEBHOOKS   AGE
elastic-webhook.k8s.elastic.co          8        717d
gloo-gateway-validation-webhook-zadig   1          129d
 kubectl describe validatingwebhookconfiguration elastic-webhook.k8s.elastic.co 

admissionregistration.k8s.io/v1beta1

1.22 版本 api 变动

还是参照 kubernetes 官网文档:
https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-22

解决问题:

能够参照:https://github.com/elastic/cloud-on-k8s/issues/3958 中 charith-elastic 的形式试一下:

我是间接抉择了降级 eck:
以后 eck 版本为 1.6,elasticsearch 版本 7.6.2,kubernetes 集群 1.22。发现绝对应反对版本起码 1.8 版本:

间接降级 eck operator 服务:https://www.elastic.co/guide/en/cloud-on-k8s/1.8/k8s-upgrading-eck.html

kubectl replace -f https://download.elastic.co/downloads/eck/1.8.0/crds.yaml
kubectl apply -f https://download.elastic.co/downloads/eck/1.8.0/operator.yaml

因为 elastic-operator-0 是一个有状态 statefulset 服务,未能失常启动,他会始终尝试。期待启动后能力进行下一次更新(如果我没有了解错的话),手动 delete elastic-operator-0 pod:

kubectl delete pods elastic-operator-0 -n elastic-system

删除 kibana pod 期待 pod running:

kubectl delete pods elastic-kb-677b867cf7-5vb2v -n logging

web 拜访 kibana 服务失常拜访!

总结:

  1. kubernetes 版本升级的 api 校验,tke 这点是不好,没有揭示用户阿,kubeadm 降级还会进行校验一遍资源呢!
  2. 降级版本前还是要检查一下 kubeadm 官网降级文档:https://kubernetes.io/docs/reference/using-api/deprecation-guide/#removed-apis-by-release
  3. 利用组建版本的 api 还是要好好检查一下!
正文完
 0