zoukankan      html  css  js  c++  java
  • KubeDNS not working inside of pod when its containers are on the same node with kube-dns containers

    pod中访问dns出现偶尔超时的问题现在定位原因是:
    [问题复现]
    若kube-dns的pod与访问dns的pod服务位于同一node节点中时无法通过service的vip访问到该pod
    k8s中的issue中也有相同的描述:https://github.com/kubernetes/kubernetes/issues/21613
    主要原因是因为:
    net.bridge.bridge-nf-call-iptables
    net.bridge.bridge-nf-call-ip6tables
    参数设置导致无法生产iptables的MASQUERADE规则,是的service的vip无法路由到pod的ip
    [解决方法]
    sysctl -w net.bridge.bridge-nf-call-iptables=1
    sysctl -w net.bridge.bridge-nf-call-ip6tables=1

    即使sysctl.conf里设置了,然后sysctl -p生效了。但是机器重启后,sysctl -a查看失效的情

    线上经常出现同一台机器上上Pod之间访问不通的问题

    线上sysctl.conf已经在机器重启正确配置, 但是docker服务启动时候会reset相关参数

    这个过程会体现在/var/log/messages中

    目前此问题并没有很完美的办法

    初步方案为修改docker service的启动过程,在启动后重新load bridge相关配置:

    Step 1:

    vim /etc/sysctl.d/bridge.conf

    net.bridge.bridge-nf-call-arptables=1

    net.bridge.bridge-nf-call-iptables=1

    net.bridge.bridge-nf-call-ip6tables=1

    Step 2:

    sudo sed -i '/ExecStart.*/aExecStartPost=/usr/lib/systemd/systemd-sysctl bridge.conf' /usr/lib/systemd/system/docker.service

  • 相关阅读:
    yum 安装pip
    sed和awk用法
    awk删除最后一个字符
    shell读取文件内容并进行变量赋值
    git 添加、提交、推送
    git 本地代码冲突解决,强制更新
    sys系统模块
    os模块
    time-时间模块
    环境变量的使用
  • 原文地址:https://www.cnblogs.com/allenhaozi/p/9553381.html
Copyright © 2011-2022 走看看