最近我使用将 Kubernetes 集群从 1.5.3 版本升级到 1.6.1 版本kubeadm
。
现在我想从 1.6.1 版本升级到 1.6.2 但是遇到此错误:
[root@master ~]#kubeadm upgrade plan --v=5
I1113 14:14:31.046080 8368 plan.go:67] [upgrade/plan] verifying health of cluster
I1113 14:14:31.046233 8368 plan.go:68] [upgrade/plan] retrieving configuration from cluster
[upgrade/config] Making sure the configuration is correct:
[upgrade/config] Reading configuration from the cluster...
[upgrade/config] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml'
I1113 14:14:31.111668 8368 common.go:122] running preflight checks
[preflight] Running pre-flight checks.
I1113 14:14:31.111843 8368 preflight.go:78] validating if there are any unsupported CoreDNS plugins in the Corefile
I1113 14:14:31.143841 8368 preflight.go:103] validating if migration can be done for the current CoreDNS release.
[preflight] Some fatal errors occurred:
[ERROR CoreDNSUnsupportedPlugins]: start version '' not supported
[ERROR CoreDNSMigration]: start version '' not supported
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
似乎kubeadm
无法解析 CoreDNS 版本。
这是 CoreDNS 配置:
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
kind: ConfigMap
metadata:
creationTimestamp: "2018-12-15T00:02:45Z"
name: coredns
namespace: kube-system
resourceVersion: "45537229"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: c01fbb58-fffc-11e8-9a01-005056a31666
从哪里读取版本号?或者我该怎么做才能解决此错误?
答案1
答案2
最后我发现了问题的原因。podcoredns
被终止并且无法自行恢复。
因此我通过以下方式移除了 pod:
kubectl -n kube-system delete pod coredns-79ff88449c-4gjzs --grace-period=0 --force
然后使用deploy.sh
脚本手动安装https://github.com/coredns/deployment/tree/master/kubernetes像这样:
./deploy.sh | kubectl apply -f -
现在kubeadm upgrade
又能像魔法一样工作了。
并且似乎kubeadm
从正在运行的 pod 中读取 CoreDNS 版本。