尝试安装 Weave Cloud Agents for Minikube 时如何解决 Kubernetes DNS 问题

How to resolve Kubernetes DNS issues when trying to install Weave Cloud Agents for Minikube

我正在尝试为我的 minikube 安装 Weave Cloud Agents。我使用了提供的命令

curl -Ls https://get.weave.works |sh -s -- --token=xxx

但不断收到以下错误:

There was an error while performing a DNS check: checking DNS failed, the DNS in the Kubernetes cluster is not working correctly. Please check that your cluster can download images and run pods.

我有以下 DNS:

kube-system   coredns-6955765f44-7zt4x                   1/1     Running            0          38m
kube-system   coredns-6955765f44-xdnd9                   1/1     Running            0          38m

我尝试了不同的建议,例如 https://www.jeffgeerling.com/blog/2019/debugging-networking-issues-multi-node-kubernetes-on-virtualbox or https://kubernetes.io/docs/tasks/administer-cluster/dns-debugging-resolution/。但是 none 他们解决了我的问题。

这似乎是 https://github.com/weaveworks/launcher/issues/285 之前发生的问题。

我的 Kubernetes 是 v1.17.3

转载你的问题,同样的错误。

minikube v1.7.2 on Centos 7.7.1908
Docker 19.03.5
vm-driver=virtualbox

Connecting cluster to "Old Tree 34" (id: old-tree-34) on Weave Cloud
Installing Weave Cloud agents on minikube at https://192.168.99.100:8443
Performing a check of the Kubernetes installation setup.
There was an error while performing a DNS check: checking DNS failed, the DNS in the Kubernetes cluster is not working correctly. Please check that your cluster can download images and run pods.

我无法解决这个问题,而是找到了解决方法 - 使用 Helm。您在 'Install the Weave Cloud Agents' 中有第二个选项卡“Helm”,其中包含提供的命令,例如

helm repo update && helm upgrade --install --wait weave-cloud \
  --set token=xxx \
  --namespace weave \
  stable/weave-cloud

让我们安装 Helm 并使用它。

curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
.....
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.


helm repo update
helm upgrade --install --wait weave-cloud \
>   --set token=xxx \
>   --namespace weave \
>   stable/weave-cloud



Release "weave-cloud" does not exist. Installing it now.    

NAME:   weave-cloud
LAST DEPLOYED: Thu Feb 13 14:52:45 2020
NAMESPACE: weave
STATUS: DEPLOYED

RESOURCES:
==> v1/Deployment
NAME         AGE
weave-agent  35s

==> v1/Pod(related)
NAME                          AGE
weave-agent-69fbf74889-dw77c  35s

==> v1/Secret
NAME         AGE
weave-cloud  35s

==> v1/ServiceAccount
NAME         AGE
weave-cloud  35s

==> v1beta1/ClusterRole
NAME         AGE
weave-cloud  35s

==> v1beta1/ClusterRoleBinding
NAME         AGE
weave-cloud  35s


NOTES:
Weave Cloud agents had been installed!

First, verify all Pods are running:

  kubectl get pods -n weave

Next, login to Weave Cloud (https://cloud.weave.works) and verify the agents are connect to your instance.

If you need help or have any question, join our Slack to chat to us – https://slack.weave.works.

Happy hacking!

检查(等待大约 10 分钟以部署所有内容):

kubectl get pods -n weave
NAME                                        READY   STATUS    RESTARTS   AGE
kube-state-metrics-64599b7996-d8pnw         1/1     Running   0          29m
prom-node-exporter-2lwbn                    1/1     Running   0          29m
prometheus-5586cdd667-dtdqq                 2/2     Running   0          29m
weave-agent-6c77dbc569-xc9qx                1/1     Running   0          29m
weave-flux-agent-65cb4694d8-sllks           1/1     Running   0          29m
weave-flux-memcached-676f88fcf7-ktwnp       1/1     Running   0          29m
weave-scope-agent-7lgll                     1/1     Running   0          29m
weave-scope-cluster-agent-8fb596b6b-mddv8   1/1     Running   0          29m
[vkryvoruchko@nested-vm-image1 bin]$ kubectl get all -n weave
NAME                                            READY   STATUS    RESTARTS   AGE
pod/kube-state-metrics-64599b7996-d8pnw         1/1     Running   0          30m
pod/prom-node-exporter-2lwbn                    1/1     Running   0          30m
pod/prometheus-5586cdd667-dtdqq                 2/2     Running   0          30m
pod/weave-agent-6c77dbc569-xc9qx                1/1     Running   0          30m
pod/weave-flux-agent-65cb4694d8-sllks           1/1     Running   0          30m
pod/weave-flux-memcached-676f88fcf7-ktwnp       1/1     Running   0          30m
pod/weave-scope-agent-7lgll                     1/1     Running   0          30m
pod/weave-scope-cluster-agent-8fb596b6b-mddv8   1/1     Running   0          30m

NAME                           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
service/prometheus             ClusterIP   10.108.197.29   <none>        80/TCP      30m
service/weave-flux-memcached   ClusterIP   None            <none>        11211/TCP   30m

NAME                                DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE
daemonset.apps/prom-node-exporter   1         1         1       1            1           <none>          30m
daemonset.apps/weave-scope-agent    1         1         1       1            1           <none>          30m

NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/kube-state-metrics          1/1     1            1           30m
deployment.apps/prometheus                  1/1     1            1           30m
deployment.apps/weave-agent                 1/1     1            1           31m
deployment.apps/weave-flux-agent            1/1     1            1           30m
deployment.apps/weave-flux-memcached        1/1     1            1           30m
deployment.apps/weave-scope-cluster-agent   1/1     1            1           30m

NAME                                                  DESIRED   CURRENT   READY   AGE
replicaset.apps/kube-state-metrics-64599b7996         1         1         1       30m
replicaset.apps/prometheus-5586cdd667                 1         1         1       30m
replicaset.apps/weave-agent-69fbf74889                0         0         0       31m
replicaset.apps/weave-agent-6c77dbc569                1         1         1       30m
replicaset.apps/weave-flux-agent-65cb4694d8           1         1         1       30m
replicaset.apps/weave-flux-memcached-676f88fcf7       1         1         1       30m
replicaset.apps/weave-scope-cluster-agent-8fb596b6b   1         1         1       30m

登录 https://cloud.weave.works/ 并检查相同的内容:

Started installing agents on Kubernetes cluster v1.17.2
All Weave Cloud agents are connected!