V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jtwor
V2EX  ›  Kubernetes

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

  •  
  •   jtwor · 2021-07-29 14:55:00 +08:00 · 2175 次点击
    这是一个创建于 973 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2021-07-30 17:24:36 +08:00
    defunct9
        1
    defunct9  
       2021-07-29 14:57:13 +08:00
    开 ssh,让我上去看看
    jtwor
        2
    jtwor  
    OP
       2021-07-29 15:00:24 +08:00
    @defunct9 尴尬) 本地虚拟机在练习 大佬有什么思路吗
    koala9527
        3
    koala9527  
       2021-07-29 15:02:43 +08:00
    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
        4
    koala9527  
       2021-07-29 15:03:19 +08:00
    pod-network-cidr:pod-network-cidr: 指定 pod 网络的 IP 地址范围,它取决于你在下一步选择的哪个网络网络插件,比如我使用的是 Calico 网络,指定为 192.168.0.0/16 。
    jtwor
        5
    jtwor  
    OP
       2021-07-29 15:08:29 +08:00
    @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
        6
    nilai  
       2021-07-29 15:55:40 +08:00
    1.你的容器网段--pod-network-cidr=192.168.0.0/16 已经包含你的机器的网段了 192.168.139.131
    2.建议你去 configmap 中修改 calico 的配置文件 确保网段跟--pod-network-cidr 定义的一至
    KeepCoding
        7
    KeepCoding  
       2021-07-29 18:26:32 +08:00
    我觉得如果机器的 ip 是 192.168.x.x,pod-network-cidr 该设置为 10.244.0.0/16
    lework1234
        8
    lework1234  
       2021-07-29 18:32:38 +08:00
    sunsulei
        9
    sunsulei  
       2021-07-29 23:47:52 +08:00 via iPhone
    @defunct9 好奇目前为止,有人让你上过了么。。 我指的服务器。😃
    jtwor
        10
    jtwor  
    OP
       2021-07-30 02:29:47 +08:00
    @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
        11
    defunct9  
       2021-07-30 06:38:52 +08:00 via iPhone
    @sunshulei 有,有很多
    AntonyXin
        12
    AntonyXin  
       2021-07-30 17:24:36 +08:00
    这个一般都不是根因,建议看看其他描述,是不是镜像没有拉群下来之类的
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2935 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 15:15 · PVG 23:15 · LAX 08:15 · JFK 11:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.