我在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无效。我错过了还是错了?你能帮忙吗?
k8s_external
插件的工作方式跳过了svc
位。请尝试使用ncs-1-dsx-1.default.bcmt01.nokia.com
,或者在区域中包含svc.
。
我曾经运行以下命令。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