gpt4 book ai didi

kubernetes - nslookup : can't resolve kubernetes. 默认

转载 作者:行者123 更新时间:2023-12-02 11:28:41 29 4
gpt4 key购买 nike

我正在尝试使用 https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/ 在 kubernetes 中学习 DNS

  • 我部署了busybox
  • kubectl get pods busybox -o wide
    NAME      READY     STATUS    RESTARTS   AGE       IP           NODE
    busybox 1/1 Running 0 16m 10.200.1.5 worker-1
  • kubectl exec -ti busybox -- nslookup kubernetes.default
    Server:    10.32.0.10
    Address 1: 10.32.0.10 kube-dns.kube-system.svc.cluster.local

    nslookup: can't resolve 'kubernetes.default'
    command terminated with exit code 1
  • 是否需要修改worker-1节点的/etc/resolv.conf文件。目前/etc/resolv.conf 内容如下
    nameserver 169.254.169.254
    search c.k8s-project-193906.internal google.internal**
  • 还有worker-1的版本
    lsb_release -a
    没有可用的 LSB 模块。
    经销商编号:Ubuntu
    说明:Ubuntu 18.04.1 LTS
    发布时间:18.04
    代号:仿生

  • 请帮我找出导致解析错误的配置。我是否需要更改 resolve.conf 文件并基于什么?

    最佳答案

    您在最新版本的 busybox docker 镜像中遇到了一个错误。使用标签 busybox:1.28而不是 latest .这个bug link is here :

    "Nslookup does not work in latest busybox image"
    "1.27/1.28 are working , 1.29/1.29.1 are not"

    这里是 失败 busybox:latest标签。
    $ kubectl run busybox --image busybox:latest --restart=Never --rm -it busybox -- sh
    If you don't see a command prompt, try pressing enter.
    / # nslookup kubernetes.default
    Server: 10.96.0.10
    Address: 10.96.0.10:53

    ** server can't find kubernetes.default: NXDOMAIN

    *** Can't find kubernetes.default: No answer
    / # exit
    pod "busybox" deleted

    这是相同的命令 成功 busybox:1.28标签。
    $ kubectl run busybox --image busybox:1.28 --restart=Never --rm -it busybox -- sh
    If you don't see a command prompt, try pressing enter.
    / # nslookup kubernetes.default
    Server: 10.96.0.10
    Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

    Name: kubernetes.default
    Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
    / # exit
    pod "busybox" deleted

    关于kubernetes - nslookup : can't resolve kubernetes. 默认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52109039/

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