jtwor

k8s 安装问题,求大佬指导一下

  •  
  •   jtwor · Jul 29, 2021 · 3660 views
    This topic created in 1924 days ago, the information mentioned may be changed or developed.

    k8s 初始化: kubeadm init --pod-network-cidr=192.168.0.0/16 --kubernetes-version=1.21.3 --apiserver-advertise-address=192.168.139.131

    网段是 192.168.0.0/16 (按照 calico 安装的 yml 取得),真实地址是 192.168.139.131

    现在安装 calico 插件,docker 镜像的进行是下载好的,pods 显示 calico 是在 running 。

    但是 describe 去看显示一直在报这个 calico-node-token-xxxx 超时,之前安装 flannel 也是同样问题

    错误信息: MountVolume.SetUp failed for volume "calico-node-token-fb9qz" : failed to sync secret cache: timed out waiting for the condition

    这个还是墙的问题吗?求大佬们指导一下

    12 replies  •  2021-07-30 17:24:36 +08:00
    defunct9
    defunct9
    Jul 29, 2021
    1
    开 ssh,让我上去看看
    jtwor
    jtwor
    OP
    Jul 29, 2021
    2
    @defunct9 尴尬) 本地虚拟机在练习 大佬有什么思路吗
    koala9527
    koala9527
    Jul 29, 2021
    3
    apiserver-advertise-address:kubeadm 使用 eth0 的默认网络接口(通常是内网 IP )做为 Master 节点的 advertise address,

    我安装过的记录是
    sudo kubeadm init --image-repository=registry.aliyuncs.com/google_containers --kubernetes-version=v1.20.0 --apiserver-advertise-address=192.168.2.181 --pod-network-cidr=192.168.0.0/16 --ignore-preflight-errors=all
    192.168.2.181 是我的 master 节点的内网地址
    koala9527
    koala9527
    Jul 29, 2021
    4
    pod-network-cidr:pod-network-cidr: 指定 pod 网络的 IP 地址范围,它取决于你在下一步选择的哪个网络网络插件,比如我使用的是 Calico 网络,指定为 192.168.0.0/16 。
    jtwor
    jtwor
    OP
    Jul 29, 2021
    5
    @koala9527 初始化应该没问题,就是 Calico 指定为 192.168.0.0/16,我初始也指定一样的。现在是执行了 kubectl apply -f calico.yml 安装插件后,pods 已经显示 calico 在 running 。

    但实际里面报:
    MountVolume.SetUp failed for volume "calico-node-token-fb9qz" : failed to sync secret cache: timed out waiting for the condition

    其余两个 dns 可能是因为插件问题继续 pending
    nilai
    nilai
    Jul 29, 2021
    6
    1.你的容器网段--pod-network-cidr=192.168.0.0/16 已经包含你的机器的网段了 192.168.139.131
    2.建议你去 configmap 中修改 calico 的配置文件 确保网段跟--pod-network-cidr 定义的一至
    KeepCoding
    KeepCoding
    Jul 29, 2021
    7
    我觉得如果机器的 ip 是 192.168.x.x,pod-network-cidr 该设置为 10.244.0.0/16
    lotmany
    lotmany
    Jul 29, 2021 via iPhone
    9
    @defunct9 好奇目前为止,有人让你上过了么。。 我指的服务器。😃
    jtwor
    jtwor
    OP
    Jul 30, 2021
    10
    @KeepCoding 看插件的 flannel 是 10.244 ,clalico 是 192.168 ,他们安装的 yml 文件都有写网段。

    找到问题了,是我的 k8s 版本高和很多网上那些教程有点不同没这么一键舒服。。

    如果出现 failed to sync secret cache: timed out waiting for the condition

    vim /var/lib/kubelet/config.yaml

    追加:
    featureGates:
    CSIMigration: false


    出现 0/1 nodes are available: 1 node(s) had taints that the pod didn't tolerate
    这里应该是我只有 master,没有其他节点,所以有问题。

    kubectl taint nodes --all node-role.kubernetes.io/master-
    能解决 pods 异常

    其实最大问题是我的 coredns 的镜像有问题 X) 重新拉取 docker 镜像最新改好 tag 就可以了。


    @lework1234 谢谢大佬分享
    defunct9
    defunct9
    Jul 30, 2021 via iPhone
    11
    @sunshulei 有,有很多
    AntonyXin
    AntonyXin
    Jul 30, 2021
    12
    这个一般都不是根因,建议看看其他描述,是不是镜像没有拉群下来之类的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1631 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 18:05 · PVG 02:05 · LAX 10:05 · JFK 13:05
    ♥ Do have faith in what you're doing.