无法解析kubernetes.default或服务

时间:2019-02-06 01:13:32

标签: ubuntu kubernetes flannel coredns

我无法从kubernetes解析服务。

kubectl get pods -l k8s-app=kube-dns --namespace kube-system
NAME                       READY   STATUS    RESTARTS   AGE   IP
coredns-86c58d9df4-gn62b   1/1     Running   0          18d   10.244.0.58
coredns-86c58d9df4-svmk5   1/1     Running   0          18d   10.244.0.59

容器不解析任何域,包括kubernetes.default

kubectl exec -ti busybox -- sh
/ # nslookup kubernetes.
defaultServer:    10.96.0.10
Address 1: 10.96.0.10

nslookup: can't resolve 'kubernetes.default'
command terminated with exit code 1

dns窗格中的日志不显示任何查询(请注意,coredns已配置为记录查询)

kubectl logs --namespace=kube-system coredns-86c58d9df4-gn62b
.:53
2019-01-18T21:44:34.271Z [INFO] CoreDNS-1.2.6
2019-01-18T21:44:34.271Z [INFO] linux/amd64, go1.11.2, 756749c
CoreDNS-1.2.6
linux/amd64, go1.11.2, 756749c
 [INFO] plugin/reload: Running configuration MD5 = f65c4821c8a9b7b5eb30fa4fbc167769
[INFO] Reloading
 [INFO] plugin/reload: Running configuration MD5 = 2394cf331ea25e9aacc36ddf69fafcdb
[INFO] Reloading complete
2019-02-04T22:23:21.266Z [INFO] 127.0.0.1:39695 - 58939 "HINFO IN 4718439545634584094.2038959545847864189. udp 57 false 512" NXDOMAIN qr,rd,ra 133 0.021492508s

托管的kube节点coredns正在运行ubuntu xenial。

I noticed there is a known issue on ubuntu hosts

我应用了自定义kubelet conf,设置了--resolv-conf=/run/systemd/resolve/resolv.conf

❯ systemctl status kubelet.service
● kubelet.service - kubelet: The Kubernetes Node Agent
   Loaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/kubelet.service.d
           └─10-kubeadm.conf
   Active: active (running) since Wed 2019-02-06 01:05:42 GMT; 5min ago
     Docs: https://kubernetes.io/docs/home/
 Main PID: 27867 (kubelet)
    Tasks: 30 (limit: 4915)
   CGroup: /system.slice/kubelet.service
           └─27867 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --cgroup-drive --resolv-conf=/run/systemd/resolve/resolv.conf

但是,我仍然无法解决任何服务。

1 个答案:

答案 0 :(得分:1)

我删除了广告连播,然后由其控制者重新安排。

现在dns查询和服务发现正在起作用。

由于我更新了do { String confirm = ... .... if(confirm.equalsIgnoreCase("N")) { break; } } while (!confirm.equalsIgnoreCase("Y")) // Code to run game or whatever is next... 还是只是需要重新启动服务,因此不确定coredns服务现在是否可以访问。