我正在尝试使用 kubeadm 初始化 kubernetes 集群,但不幸的是,它没有按预期工作。这是 kubeadm 配置文件:
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: "v1.19.16"
networking:
podSubnet: "10.230.0.0/16"
dnsDomain: "company.internal"
etcd:
external:
endpoints:
- https://kube-etcd-1:2379
- https://kube-etcd-2:2379
- https://kube-etcd-3:2379
不幸的是,当我尝试使用以下命令初始化它时,我不断收到此错误kubeadm init --config /root/.config/new-config.yaml
:
controller-manager.conf 文件不存在或无效:stat /etc/kubernetes/controller-manager.conf: 没有此文件或目录
kubeadm 自动识别证书已生成并且可以在 /etc/kubernetes/pki 下找到的事实,只有在这种情况下我才会收到此错误。如果我删除证书,它将自行生成所有内容,包括controller-manager.conf
。关于如何解决这个问题有什么想法吗?
使用--v = 5除了基本上无法找到controll-manager.conf之外,没有提供任何其他见解:
kube-controlplane-1:/etc/kubernetes/pki# kubeadm init --config /root/.config/new-config.yaml --v=6
I1221 00:15:05.160594 1964 initconfiguration.go:200] loading configuration from "/root/.config/new-config.yaml"
I1221 00:15:05.164578 1964 initconfiguration.go:103] detected and using CRI socket: /run/containerd/containerd.sock
I1221 00:15:05.165098 1964 interface.go:400] Looking for default routes with IPv4 addresses
I1221 00:15:05.165142 1964 interface.go:405] Default route transits interface "ens192"
I1221 00:15:05.165518 1964 interface.go:208] Interface ens192 is up
I1221 00:15:05.165730 1964 interface.go:256] Interface "ens192" has 2 addresses :[10.88.88.225/24 fe80::250:56ff:febe:79f5/64].
I1221 00:15:05.165856 1964 interface.go:223] Checking addr 10.88.88.225/24.
I1221 00:15:05.165901 1964 interface.go:230] IP found 10.88.88.225
I1221 00:15:05.165937 1964 interface.go:262] Found valid IPv4 address 10.88.88.225 for interface "ens192".
I1221 00:15:05.165969 1964 interface.go:411] Found active IP 10.88.88.225
W1221 00:15:05.180639 1964 configset.go:348] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]
stat /etc/kubernetes/controller-manager.conf: no such file or directory
the controller-manager.conf file does not exists or it is not valid
k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig.ValidateKubeconfigsForExternalCA
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/phases/kubeconfig/kubeconfig.go:372
k8s.io/kubernetes/cmd/kubeadm/app/cmd.newInitData
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/cmd/init.go:386
k8s.io/kubernetes/cmd/kubeadm/app/cmd.NewCmdInit.func3
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/cmd/init.go:193
k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow.(*Runner).InitData
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/cmd/phases/workflow/runner.go:183
k8s.io/kubernetes/cmd/kubeadm/app/cmd.NewCmdInit.func1
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/cmd/init.go:141
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).execute
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/github.com/spf13/cobra/command.go:842
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/github.com/spf13/cobra/command.go:950
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).Execute
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/github.com/spf13/cobra/command.go:887
k8s.io/kubernetes/cmd/kubeadm/app.Run
/workspace/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/app/kubeadm.go:50
main.main
_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubeadm/kubeadm.go:25
runtime.main
/usr/local/go/src/runtime/proc.go:204
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1374
欢迎提出任何有关如何调试的想法!
谢谢!
后来编辑:kubeadm 版本:1.19.16
答案1
好吧,如果没有 kubeadm 的版本,我们只能猜测,但总体思路是外部 CA 模式(您因ca.crt 存在,但密钥不存在)该方法假设您正在以“已配置”模式部署,因此和controller-manager.conf
应该scheduler.conf
已经存在
简而言之,就是确保你了解目录内容的情况/etc/kubernetes
,下次发布你正在使用的相关版本