【问题标题】:K8s coreDNS plugin k8s_external seems not work in my k8s clusterK8s coreDNS 插件 k8s_external 在我的 k8s 集群中似乎不起作用
【发布时间】:2021-06-18 03:32:09
【问题描述】:

我在我的 k8s 集群中启用了 k8s_external,但它似乎不起作用。

核心文件更新如下:

kubernetes cluster.local
k8s_external bcmt01.nokia.com

然后我删除 coredns pod 让更新的 corefile 生效。然后我创建一个服务如下:

kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE 
kubernetes ClusterIP 10.254.0.1 443/TCP 7d20h 
ncs-1-dsx-1 LoadBalancer 10.254.203.4 135.111.190.183 22389:30944/TCP,8989:32634/TCP 48m 
ncs-1-dsx-3 LoadBalancer 10.254.203.3 135.111.190.180 22389:30387/TCP,8989:30697/TCP 2d20h
------------------------------------------------------------------------

当我尝试 curl ncs-1-dsx-1.default.svc.cluster.local:22389 时,它可以工作并且 curl 135.111.190.183:22389,它可以工作,但是 curl ncs-1-dsx-1.default.svc .bcmt01.nokia.com:22389,它不起作用。我错过了还是错了?你能帮忙吗?

【问题讨论】:

    标签: kubernetes external coredns


    【解决方案1】:

    k8s_external 插件的工作方式跳过了svc 位。请改用ncs-1-dsx-1.default.bcmt01.nokia.com 或在区域中包含svc.

    【讨论】:

    • 感谢回复,试了下还是失败:(如下:[root@bcmt-01-control-01 coredns]# curl ncs-1-dsx-1.default.bcmt01.nokia .com:22389 curl:(6)无法解析主机:ncs-1-dsx-1.default.bcmt01.nokia.com;未知错误[root@bcmt-01-control-01 coredns]
    【解决方案2】:

    我曾经在命令下运行。 dig 命令好像成功了,但是ping & curl 失败了,如下:

    [root@bcmt-01-control-01 coredns]# kubectl -n kube-system get svc|grep dns
    kube-dns                    ClusterIP   10.254.0.10      <none>  53/UDP,53/TCP,9153/TCP   8d
    
    [root@bcmt-01-control-01 coredns]# dig @10.254.0.10 ncs-1-dsx-1.default.bcmt01.nokia.com +short
    135.111.190.183
    
    [root@bcmt-01-control-01 coredns]# curl ncs-1-dsx-1.default.bcmt01.nokia.com:22389
    curl: (6) Could not resolve host: ncs-1-dsx-1.default.bcmt01.nokia.com; Unknown error
    
    [root@bcmt-01-control-01 coredns]# curl 135.111.190.183:22389
    0▒0x▒)
    The client sent a request to the Directory Server that could not be properly decoded as an ASN.1 element:  com.unboundid.asn1.ASN1Exception: Unable to decode the provided ASN.1 element ASN1Element(type=47, valueLength=69, valueBytes='54202f20485454502f312e310d0a557365722d4167656e743a206375726c2f372e32392e300d0a486f73743a203133352e3131312e3139302e3138333a32323338390d0a41') as a sequence because the decoded length of an embedded element exceeds the number of bytes remaining..  Data from client: [readBytes=47 45 54 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A 55 73 65 72 2D 41 67 65 6E 74 3A 20 63 75 72 6C 2F 37 2E 32 39 2E 30 0D 0A 48 6F 73 74 3A 20 31 33 35 2E 31 31 31 2E 31 39 30 2E 31 38 33 3A 32 32 33 38 39 0D 0A 41 unreadBytes=63 63 65 70 74 3A 20 2A 2F 2A 0D 0A 0D 0A]▒1.3.6.1.4.1.1466.20036
    

    【讨论】:

    • 嗨,我很难判断这是否是这个问题的答案。这部分不应该包含在问题中吗?您是否也在从其中一个节点查询 dns 服务器?从Pod查询它是否有效?
    • 感谢您的回复。在 pod 中,我运行 curl ncs-1-dsx-1.default.bcmt01.nokia.com:22389,但它失败了。
    • 据我了解,您发布的答案不是问题的答案。我鼓励你删除它并用这篇文章的内容更新你的问题。同样,dig 命令有效,您能否从Pod 检查 curl 与--dns-servers 是否有效? $ curl --dns-servers 10.254.0.10 curl ncs-1-dsx-1.default.bcmt01.nokia.com:22389
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-18
    • 2019-08-03
    • 2021-03-04
    • 2021-03-03
    • 1970-01-01
    • 2020-06-26
    相关资源
    最近更新 更多