kubernetes skydns 转发请求失败

2023-12-25

我正在创建一个 1 个主节点 2 个节点的 kubernetes 集群。我正在尝试基于以下内容创建 skydns:

apiVersion: v1
kind: ReplicationController
metadata:
  name: kube-dns-v11
  namespace: kube-system
  labels:
    k8s-app: kube-dns
    version: v11
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    k8s-app: kube-dns
    version: v11
  template:
    metadata:
      labels:
        k8s-app: kube-dns
        version: v11
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
      - name: etcd
        image: gcr.io/google_containers/etcd-amd64:2.2.1
        # resources:
        #   # TODO: Set memory limits when we've profiled the container for large
        #   # clusters, then set request = limit to keep this container in
        #   # guaranteed class. Currently, this container falls into the
        #   # "burstable" category so the kubelet doesn't backoff from restarting it.
        #   limits:
        #     cpu: 100m
        #     memory: 500Mi
        #   requests:
        #     cpu: 100m
        #     memory: 50Mi
        command:
        - /usr/local/bin/etcd
        - -data-dir
        - /var/etcd/data
        - -listen-client-urls
        - http://127.0.0.1:2379,http://127.0.0.1:4001
        - -advertise-client-urls
        - http://127.0.0.1:2379,http://127.0.0.1:4001
        - -initial-cluster-token
        - skydns-etcd
        volumeMounts:
        - name: etcd-storage
          mountPath: /var/etcd/data
      - name: kube2sky
        image: gcr.io/google_containers/kube2sky:1.14
        # resources:
        #   # TODO: Set memory limits when we've profiled the container for large
        #   # clusters, then set request = limit to keep this container in
        #   # guaranteed class. Currently, this container falls into the
        #   # "burstable" category so the kubelet doesn't backoff from restarting it.
        #   limits:
        #     cpu: 100m
        #     # Kube2sky watches all pods.
        #     memory: 200Mi
        #   requests:
        #     cpu: 100m
        #     memory: 50Mi
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          # successThreshold: 1
          # failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /readiness
            port: 8081
            scheme: HTTP
          # we poll on pod startup for the Kubernetes master service and
          # only setup the /readiness HTTP server once that's available.
          initialDelaySeconds: 30
          timeoutSeconds: 5
        args:
        # command = "/kube2sky"
        - --domain=cluster.local
      - name: skydns
        image: gcr.io/google_containers/skydns:2015-10-13-8c72f8c
        resources:
          # TODO: Set memory limits when we've profiled the container for large
          # clusters, then set request = limit to keep this container in
          # guaranteed class. Currently, this container falls into the
          # "burstable" category so the kubelet doesn't backoff from restarting it.
          limits:
            cpu: 100m
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 50Mi
        args:
        # command = "/skydns"
        - -machines=http://127.0.0.1:4001
        - -addr=0.0.0.0:53
        - -ns-rotate=false
        - -domain=cluster.local
        ports:
        - containerPort: 53
          name: dns
          protocol: UDP
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
      - name: healthz
        image: gcr.io/google_containers/exechealthz:1.0
        # resources:
        #   # keep request = limit to keep this container in guaranteed class
        #   limits:
        #     cpu: 10m
        #     memory: 20Mi
        #   requests:
        #     cpu: 10m
        #     memory: 20Mi
        args:
        - -cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null
        - -port=8080
        ports:
        - containerPort: 8080
          protocol: TCP
      volumes:
      - name: etcd-storage
        emptyDir: {}
      dnsPolicy: Default  # Don't use cluster DNS.

然而,skydns 吐出以下内容:

> $kubectl logs kube-dns-v11-k07j9 --namespace=kube-system  skydns 
> 2016/04/18 12:47:05 skydns: falling back to default configuration,
> could not read from etcd: 100: Key not found (/skydns) [1]  2016/04/18
> 12:47:05 skydns: ready for queries on cluster.local. for
> tcp://0.0.0.0:53 [rcache 0]  2016/04/18 12:47:05 skydns: ready for
> queries on cluster.local. for udp://0.0.0.0:53 [rcache 0]  2016/04/18
> 12:47:11 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:47:15 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout" 2016/04/18
> 12:47:19 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:47:23 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout" 2016/04/18
> 12:47:27 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:47:31 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout" 2016/04/18
> 12:47:35 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:47:39 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout" 2016/04/18
> 12:47:43 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:47:47 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout" 2016/04/18
> 12:47:51 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:47:55 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout" 2016/04/18
> 12:47:59 skydns: failure to forward request "read udp
>     192.168.122.1:53: i/o timeout" 2016/04/18 12:48:03 skydns: failure to forward request "read udp 192.168.122.1:53: i/o timeout"

进一步查看后,我才意识到 192.168.122.1 是什么?它是kvm上的虚拟交换机。为什么 skydns 试图访问我的虚拟交换机或虚拟机的 dns 服务器?


SkyDNS默认其转发名称服务器为中列出的名称服务器/etc/resolv.conf. Since SkyDNS运行在kube-dnspod 作为集群插件,它继承了它的/etc/resolv.conf从其主机中描述的kube-dns doc https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns#inheriting-dns-from-the-node.

从你的问题看来,你的主机/etc/resolv.conf配置为使用 192.168.122.1 作为其名称服务器,因此它成为您的转发服务器SkyDNS配置。我相信 192.168.122.1 无法从您的 Kubernetes 集群路由,这就是为什么您在kube-dns logs.

此问题最简单的解决方案是提供一个可访问的 DNS 服务器作为标志SkyDNS在你的 RC 配置中。这是一个示例(这只是您的 RC 配置,但添加了-nameservers标志在SkyDNS集装箱规格):

apiVersion: v1
kind: ReplicationController
metadata:
  name: kube-dns-v11
  namespace: kube-system
  labels:
    k8s-app: kube-dns
    version: v11
    kubernetes.io/cluster-service: "true"
spec:
  replicas: 1
  selector:
    k8s-app: kube-dns
    version: v11
  template:
    metadata:
      labels:
        k8s-app: kube-dns
        version: v11
        kubernetes.io/cluster-service: "true"
    spec:
      containers:
      - name: etcd
        image: gcr.io/google_containers/etcd-amd64:2.2.1
        # resources:
        #   # TODO: Set memory limits when we've profiled the container for large
        #   # clusters, then set request = limit to keep this container in
        #   # guaranteed class. Currently, this container falls into the
        #   # "burstable" category so the kubelet doesn't backoff from restarting it.
        #   limits:
        #     cpu: 100m
        #     memory: 500Mi
        #   requests:
        #     cpu: 100m
        #     memory: 50Mi
        command:
        - /usr/local/bin/etcd
        - -data-dir
        - /var/etcd/data
        - -listen-client-urls
        - http://127.0.0.1:2379,http://127.0.0.1:4001
        - -advertise-client-urls
        - http://127.0.0.1:2379,http://127.0.0.1:4001
        - -initial-cluster-token
        - skydns-etcd
        volumeMounts:
        - name: etcd-storage
          mountPath: /var/etcd/data
      - name: kube2sky
        image: gcr.io/google_containers/kube2sky:1.14
        # resources:
        #   # TODO: Set memory limits when we've profiled the container for large
        #   # clusters, then set request = limit to keep this container in
        #   # guaranteed class. Currently, this container falls into the
        #   # "burstable" category so the kubelet doesn't backoff from restarting it.
        #   limits:
        #     cpu: 100m
        #     # Kube2sky watches all pods.
        #     memory: 200Mi
        #   requests:
        #     cpu: 100m
        #     memory: 50Mi
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 60
          timeoutSeconds: 5
          # successThreshold: 1
          # failureThreshold: 5
        readinessProbe:
          httpGet:
            path: /readiness
            port: 8081
            scheme: HTTP
          # we poll on pod startup for the Kubernetes master service and
          # only setup the /readiness HTTP server once that's available.
          initialDelaySeconds: 30
          timeoutSeconds: 5
        args:
        # command = "/kube2sky"
        - --domain=cluster.local
      - name: skydns
        image: gcr.io/google_containers/skydns:2015-10-13-8c72f8c
        resources:
          # TODO: Set memory limits when we've profiled the container for large
          # clusters, then set request = limit to keep this container in
          # guaranteed class. Currently, this container falls into the
          # "burstable" category so the kubelet doesn't backoff from restarting it.
          limits:
            cpu: 100m
            memory: 200Mi
          requests:
            cpu: 100m
            memory: 50Mi
        args:
        # command = "/skydns"
        - -machines=http://127.0.0.1:4001
        - -addr=0.0.0.0:53
        - -ns-rotate=false
        - -domain=cluster.local
        - -nameservers=8.8.8.8:53,8.8.4.4:53  # Adding this flag. Dont use double quotes.
        ports:
        - containerPort: 53
          name: dns
          protocol: UDP
        - containerPort: 53
          name: dns-tcp
          protocol: TCP
      - name: healthz
        image: gcr.io/google_containers/exechealthz:1.0
        # resources:
        #   # keep request = limit to keep this container in guaranteed class
        #   limits:
        #     cpu: 10m
        #     memory: 20Mi
        #   requests:
        #     cpu: 10m
        #     memory: 20Mi
        args:
        - -cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null
        - -port=8080
        ports:
        - containerPort: 8080
          protocol: TCP
      volumes:
      - name: etcd-storage
        emptyDir: {}
      dnsPolicy: Default  # Don't use cluster DNS.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

kubernetes skydns 转发请求失败 的相关文章

随机推荐

  • 是否有一个 C# 库提供像 numpy 这样的数组操作[关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 我开始使用 Numpy 并且非常喜欢它的数组处理功能 我可以在 C 中使用一些库来提供与数组类似的功能吗 我最想要的功能是 从另一个数组创建一个数组
  • 如何在 JavaScript 中添加 ? [复制]

    这个问题在这里已经有答案了 我需要使用appendChild 或 jQuey 的append 附加一些
  • Jquery if $(window) 向下滚动函数[重复]

    这个问题在这里已经有答案了 你好 我需要什么时候 window 向下滚动100 提醒某事 我该怎么做 Try window scroll function if window scrollTop window height document
  • 是否可以重新定义 PHP 常量?

    是否可以重新定义类常量 在 PHP 中 e g class B const C ThisIsAConstant 1 class A extends B self C ThisIsAConstant 2 不 当然不 那么它们就不再是 常数
  • Angular 根据环境动态交换 SASS 样式

    我将 Angular 6 与新的 angular json 文件一起使用 我在其中配置了单独的配置 在这个新配置中 我将 Constants scss 替换为 Constants newconfig scss 运行 ngserve conf
  • 如何在 SQL 中选择没有空值的行(在任何列中)?

    我有一张桌子叫table1 它有 100 列 col1 col2 col100 我明白如何SELECT rows not例如 在特定列中包含空值col1 SELECT FROM table1 WHERE col1 IS NOT NULL 我
  • python 集合推导式是如何工作的?

    Q1 以下是set of a generator expression or a set comprehension 或者它们是相同的吗 如果是的话 是list dict理解也相应的类型转换在发电机上 my set x for x in r
  • html 编码/解码 - ckeditor

    我在 cshtml 页面中使用 ckeditor 将内容输入到我的数据库中 这些内容稍后将显示在带有 html 标签的页面上 以使文本更易于阅读 由于我通过文本区域输入内容 因此收到一条错误消息 指出我正在输入的 html 标签 h1 p
  • 如何在 Matlab 中对齐来自 Kinect 的 RGB 和深度图像

    我正在尝试使用 Matlab 对齐来自 Kinect 的 RGB 和深度图像 我正在尝试使用以下算法来做到这一点this http burrus name index php Research KinectCalibration tocLi
  • php-fpm 不创建 .sock 文件

    我有一个在 Amazon Linux 上运行的 AWS 服务器 我使用本指南安装 php7 页面底部 https forums aws amazon com thread jspa messageID 695576 https forums
  • 如何在R中的xyplot中获得阴影背景?

    using xyplot来自lattice包中 我绘制了多年的时间序列 我会为其中一些年份添加阴影区域 以表明这个时期是 特殊的 例如战争 如果这是微不足道的 请道歉 但我不知道该怎么做 所以如果有人可以帮助我 或者至少为我指出正确的方向
  • 寻找将 Lucene.net 与 ASP.NET 结合使用的示例 [已关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心 help reopen questi
  • 如何将三列设为主键

    我正在尝试学习如何将两个文件匹配在一起 但我已经尝试了 5 个小时了 但仍然不知道该怎么做 第一个文件 600 000 行 包含 4 列 Postal Number Houseletter livingspace 第二个文件 7 000 行
  • 如何让 gcloud auth activate-service-account 持续存在

    我正在使用 bq 命令行工具从 Bigquery 表进行查询 当我登录并退出查询进程正在运行的盒子时 有没有办法让服务帐户身份验证持续存在 我所做的步骤 我登录了linux盒子 通过运行以下命令来验证服务帐户 gcloud auth act
  • Java - 当数据超出限制时打印消息?

    我的代码已经可以工作了 虽然不漂亮 但确实是工作 现在我想编写一段代码 如果文本文件中有 19 条或更多数据 则停止加载数据 然后显示例如 显示 输入无效 的消息 我不知道如何做到这一点 所以任何帮助将不胜感激 package stacka
  • htaccess 外部重写/内部重定向

    我想通过 htaccess 文件实现两件事 第一个是 www hostname com index php question gt www hostname com question www hostname com index php m
  • GWT 远程日志记录无法记录 Throwable Stacktrace?

    我想使用 GWT远程记录 http www gwtproject org doc latest DevGuideLogging html 这就是我所做的 在我的 web xml 文件中我做了
  • 用于列出 GCP firebase 函数的 Firebase 命令行

    我有 100 个函数部署到 firebase 我想知道是否可以使用 firebase 命令行工具列出我的计算机上的远程函数 我想查看部署的功能列表 我想解决的是 批量部署功能 避免部署限制 在本地删除 重命名函数然后部署整个函数时出现部署错
  • 截断 UILabel 中的部分文本

    我的要求是 我需要在标签中显示文本 如果文本长度太大而无法容纳在一行中 我需要在末尾截断它 这样只有最后几个字符 通常是黑白 1 1000 的数字 因此文本长度可能会有所不同 是可见的 并且其之前的文本被 截断 所以文本看起来像 abcde
  • kubernetes skydns 转发请求失败

    我正在创建一个 1 个主节点 2 个节点的 kubernetes 集群 我正在尝试基于以下内容创建 skydns apiVersion v1 kind ReplicationController metadata name kube dns