gpt4 book ai didi

kubernetes - 无法启动 kubernetes API 服务器

转载 作者:行者123 更新时间:2023-12-02 11:43:33 24 4
gpt4 key购买 nike

实际问题:

无法启动 kubernetes API,因此无法启动 kube 服务,例如:
kubectl 版本
kubect 获取节点

/home/ubuntu# kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}



The connection to the server localhost:8080 was refused - did you specify the right host or port ?

问题背景:

安装了 Docker。
使用下面的命令安装 kube 组件:
apt-get update && apt-get install -y kubeadm kubelet kubectl

但是,当执行 kubeadm init --apiserver-advertise-address=$myip --ignore-preflight-errors=all:
I0408 09:09:07.316109       1 client.go:352] scheme "" not registered, fallback to default scheme
I0408 09:09:07.319904 1 asm_amd64.s:1337] ccResolverWrapper: sending new addresses to cc: [{127.0.0.1:2379 0 <nil>}]
I0408 09:09:07.323010 1 asm_amd64.s:1337] balancerWrapper: got update addr from Notify: [{127.0.0.1:2379 <nil>}]
W0408 09:09:07.332669 1 clientconn.go:1251] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 0 <nil>}. Err :connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused". Reconnecting...
I0408 09:09:08.325625 1 client.go:352] parsed scheme: ""
I0408 09:09:08.325650 1 client.go:352] scheme "" not registered, fallback to default scheme
I0408 09:09:08.325707 1 asm_amd64.s:1337] ccResolverWrapper: sending new addresses to cc: [{127.0.0.1:2379 0 <nil>}]
I0408 09:09:08.325768 1 asm_amd64.s:1337] balancerWrapper: got update addr from Notify: [{127.0.0.1:2379 <nil>}]
W0408 09:09:08.326158 1 clientconn.go:1251] grpc: addrConn.createTransport failed to connect to {127.0.0.1:2379 0 <nil>}. Err :connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:2379: connect: connection refused". Reconnecting...

在 kube api 容器日志中获取上述内容。这是全新安装。也尝试过
sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

预期成绩:

kubectl 版本:应仅提供版本详细信息,而没有任何连接问题消息
Kubectl get nodes:应该给出Master节点的详细信息和状态

最佳答案

下面实际上解决了我的问题,不确定这是否是实际发现的:

apt-get update && \
apt-get install -y apt-transport-https add-apt-repository "deb [arch=amd64] download.docker.com/linux/ubuntu bionic stable" curl -s packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - echo "deb apt.kubernetes.io kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list apt update && \
apt install -qy docker.io apt-get update && \
apt-get install -y kubeadm kubelet kubectl kubernetes-cni kubeadm init --ignore-preflight-errors=all –
我之前在安装 docker.ce 作为 kubernetes 安装的一部分。
现在我尝试使用 docker.io,效果很好,没有进一步的问题。它现在按预期工作。

关于kubernetes - 无法启动 kubernetes API 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55571566/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com