我正在尝试在CentOS 7.3服务器上安装Kubernetes群集。经过一些进展后,我不得不安装CNI插件。要安装插件,我需要传递一个从“kubectl version”命令输出中提取的参数。但是,获取所需信息时,命令会收到错误,服务器版本:
[root@bigdev1 ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.0", GitCommit:"fff5156092b56e6bd60fff75aad4dc9de6b6ef37", GitTreeState:"clean", BuildDate:"2017-03-28T16:36:33Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"linux/amd64"}
Error from server (NotFound): the server could not find the requested resource
实际上我开始使用版本kubeadm 1.7.3(和Docker 17)的默认文档(https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/),但卡在支票上:
[root@bigdev1 ~]# kubeadm init --pod-network-cidr=10.244.0.0/16
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.7.4
[init] Using Authorization modes: [Node RBAC]
[preflight] Running pre-flight checks
[preflight] WARNING: docker version is greater than the most recently validated version. Docker version: 17.03.1-ce. Max validated version: 1.12
[preflight] Starting the kubelet service
[kubeadm] WARNING: starting in 1.8, tokens expire after 24 hours by default (if you require a non-expiring token use --token-ttl 0)
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [bigdev1 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 10.0.109.20]
[certificates] Generated API server kubelet client certificate and key.
[certificates] Generated service account token signing key and public key.
[certificates] Generated front-proxy CA certificate and key.
[certificates] Generated front-proxy client certificate and key.
[certificates] Valid certificates and keys now exist in "/etc/kubernetes/pki"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[apiclient] Created API client, waiting for the control plane to become ready
(永远在这里等待)
然后我将Docker版本减少到1.12.6,将kubernetes版本减少到1.6.0 修改kubeadm配置后。也停止将cidr参数传递给kubeadm init。
如果您能提出任何建议以解决此问题或给出以下命令的结果,我将很高兴:
kubectl版本| base64 | tr -d'\ n'
提前致谢。
答案 0 :(得分:0)
不确定您关注哪个文档。我建议使用kubeadm
配置群集。
https://kubernetes.io/docs/setup/independent/install-kubeadm/
答案 1 :(得分:0)
这应该给您命令的结果:
kubectl版本2>&1 | base64 | tr -d'\ n'