minikube 服务 url 连接被拒绝
minikube service url connection refused
我是 kubernetes 的初学者。我正在尝试安装 minikube 想要 运行 我在 kubernetes 中的应用程序。我正在使用 ubuntu 16.04
我已按照此处提供的安装说明进行操作
https://kubernetes.io/docs/setup/learning-environment/minikube/#using-minikube-with-an-http-proxy
问题一:
安装 kubectl、virtualbox 和 minikube 后,我有 运行 命令
minikube start --vm-driver=virtualbox
失败并出现以下错误
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
E0912 17:39:12.486830 17689 start.go:305] Error restarting
cluster: restarting kube-proxy: waiting for kube-proxy to be
up for configmap update: timed out waiting for the condition
但是当我检查 virtualbox 时我看到了 minikube VM 运行ning 并且当我 运行 kubectl
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
我看到了部署
kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
hello-minikube 1 1 1 1 27m
我将 hello-minikube 部署公开为服务
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube LoadBalancer 10.102.236.236 <pending> 8080:31825/TCP 15m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19h
我得到了url服务
minikube service hello-minikube --url
http://192.168.99.100:31825
当我尝试 curl url 时,出现以下错误
curl http://192.168.99.100:31825
curl: (7) Failed to connect to 192.168.99.100 port 31825: Connection refused
1)如果minikube集群启动失败,kubectl是如何连接到minikube进行部署和服务的?
2) 如果集群正常,那为什么我的连接被拒绝了?
我在看这个代理(https://kubernetes.io/docs/setup/learning-environment/minikube/#starting-a-cluster)这个里面的my_proxy是什么?
这是 minikube 的 ip 和一些端口吗?
我试过了
但不明白解决方案中的#3(设置代理)将如何完成。有人可以帮我获取代理说明吗?
添加评论中要求的命令输出
kubectl get po -n kube-system
NAME READY STATUS RESTARTS AGE
etcd-minikube 1/1 Running 0 4m
kube-addon-manager-minikube 1/1 Running 0 5m
kube-apiserver-minikube 1/1 Running 0 4m
kube-controller-manager-minikube 1/1 Running 0 6m
kube-dns-86f4d74b45-sdj6p 3/3 Running 0 5m
kube-proxy-7ndvl 1/1 Running 0 5m
kube-scheduler-minikube 1/1 Running 0 5m
kubernetes-dashboard-5498ccf677-4x7sr 1/1 Running 0 5m
storage-provisioner 1/1 Running 0 5m
I deleted minikube and removed all files under ~/.minikube and
reinstalled minikube. Now it is working fine. I did not get the output
before but I have attached it after it is working to the question. Can
you tell me what does the output of this command tells ?
当您的 Minikube Kubernetes 集群 已经被删除并重新设置时,很难甚至不可能判断它到底出了什么问题。
基本上,您可以采取一些措施来正确解决或调试您的问题。
Adding the command output which was asked in the comments
您发布的输出实际上只是@Eduardo Baitello 要求您完成的任务的一部分。 kubectl get po -n kube-system
命令只是显示 Pods
in kube-system
namespace 的列表。换句话说,这是构成您的 Kubernetes 集群的系统 pods 的列表,正如您可以想象的那样,这些组件中的每一个的正常运行都是至关重要的。正如您在输出中看到的,kube-proxy
pod 的 STATUS
是 Running
:
kube-proxy-7ndvl 1/1 Running 0 5m
@Eduardo 的问题中还要求您检查其日志。你可以通过发出:
kubectl logs kube-proxy-7ndvl
它可以告诉您在问题发生时这个特定的 pod 出了什么问题。此外,在这种情况下,您可以使用 describe
命令查看其他 pod 详细信息(有时查看 pod 事件可能有助于弄清楚它发生了什么):
kubectl describe pod kube-proxy-7ndvl
检查此特定 Pod
状态和日志的建议很可能是受 Minikube 启动过程中显示的错误消息片段的启发:
E0912 17:39:12.486830 17689 start.go:305] Error restarting
cluster: restarting kube-proxy: waiting for kube-proxy to be
up for configmap update: timed out waiting for the condition
如您所见,此消息清楚地表明 "something wrong" 与 kube-proxy
之间存在简短关系,因此首先检查它很有意义。
还有一件事你可能没有注意到:
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube LoadBalancer 10.102.236.236 <pending> 8080:31825/TCP 15m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19h
您的 hello-minikube
服务还没有完全准备好。在 EXTERNAL-IP
列中,您可以看到它的状态是 pending
。正如您可以使用 describe
命令来描述 Pods
一样,您可以这样做以获取服务的详细信息。简单:
describe service hello-minikube
在这种情况下可以告诉你很多。
1)If minikube cluster got failed while starting, how did the kubectl
able to connect to minikube to do deployments and services? 2) If
cluster is fine, then why am i getting connection refused ?
请记住,Kubernetes 集群 不是一个整体结构,它由许多相互依赖的部分组成。 kubectl
工作并且您可以创建部署这一事实并不意味着整个集群工作正常,正如您在错误消息中看到的那样,它暗示其组件之一,即 kube-proxy
,实际上可能无法正常运行。
回到问题的开头...
I have followed the installation instructions provided here
https://kubernetes.io/docs/setup/learning-environment/minikube/#using-minikube-with-an-http-proxy
Issue1: After installing kubectl, virtualbox and minikube I have run
the command
minikube start --vm-driver=virtualbox
据我所知,您没有使用 http 代理,所以您没有按照您发布的文档的这个特定片段中的说明进行操作,对吗?
我的印象是你混淆了两个概念。 kube-proxy
这是一个 Kubernetes cluster
组件,在 kube-system
space 和 http proxy server mentioned in this 文档片段中部署为 pod。
I was looking at this
proxy(https://kubernetes.io/docs/setup/learning-environment/minikube/#starting-a-cluster)
what is my_proxy in this ?
如果您不知道您的 http proxy 地址是什么,很可能您根本就没有使用它,如果您不使用它从您的计算机连接到 Internet,它不适用于您的情况。
否则,您需要通过 providing additional flags when you start it 为您的 Minikube 进行如下设置:
minikube start --docker-env http_proxy=http://$YOURPROXY:PORT \
--docker-env https_proxy=https://$YOURPROXY:PORT
如果您能够启动您的 Minikube,现在它仅使用以下命令即可正常工作:
minikube start --vm-driver=virtualbox
你的问题是由其他原因引起的,你不需要提供上面提到的标志来告诉你的 Minikube 你的 http 代理服务器是什么你正在使用.
据我所知,目前一切正常,运行ning,您可以毫无问题地访问命令 minikube service hello-minikube --url
返回的 url,对吗?您还可以 运行 命令 kubectl get service hello-minikube
并检查其输出是否与您之前发布的不同。由于您没有附加任何 yaml 定义文件,因此很难判断您的服务定义是否有问题。另请注意,Load Balancer
是一种服务类型,旨在与云提供商提供的外部负载平衡器一起使用,而 minikube 使用 NodePort
代替它。
我是 kubernetes 的初学者。我正在尝试安装 minikube 想要 运行 我在 kubernetes 中的应用程序。我正在使用 ubuntu 16.04
我已按照此处提供的安装说明进行操作 https://kubernetes.io/docs/setup/learning-environment/minikube/#using-minikube-with-an-http-proxy
问题一: 安装 kubectl、virtualbox 和 minikube 后,我有 运行 命令
minikube start --vm-driver=virtualbox
失败并出现以下错误
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
E0912 17:39:12.486830 17689 start.go:305] Error restarting
cluster: restarting kube-proxy: waiting for kube-proxy to be
up for configmap update: timed out waiting for the condition
但是当我检查 virtualbox 时我看到了 minikube VM 运行ning 并且当我 运行 kubectl
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
我看到了部署
kubectl get deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
hello-minikube 1 1 1 1 27m
我将 hello-minikube 部署公开为服务
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube LoadBalancer 10.102.236.236 <pending> 8080:31825/TCP 15m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19h
我得到了url服务
minikube service hello-minikube --url
http://192.168.99.100:31825
当我尝试 curl url 时,出现以下错误
curl http://192.168.99.100:31825
curl: (7) Failed to connect to 192.168.99.100 port 31825: Connection refused
1)如果minikube集群启动失败,kubectl是如何连接到minikube进行部署和服务的? 2) 如果集群正常,那为什么我的连接被拒绝了?
我在看这个代理(https://kubernetes.io/docs/setup/learning-environment/minikube/#starting-a-cluster)这个里面的my_proxy是什么?
这是 minikube 的 ip 和一些端口吗?
我试过了
但不明白解决方案中的#3(设置代理)将如何完成。有人可以帮我获取代理说明吗?
添加评论中要求的命令输出
kubectl get po -n kube-system
NAME READY STATUS RESTARTS AGE
etcd-minikube 1/1 Running 0 4m
kube-addon-manager-minikube 1/1 Running 0 5m
kube-apiserver-minikube 1/1 Running 0 4m
kube-controller-manager-minikube 1/1 Running 0 6m
kube-dns-86f4d74b45-sdj6p 3/3 Running 0 5m
kube-proxy-7ndvl 1/1 Running 0 5m
kube-scheduler-minikube 1/1 Running 0 5m
kubernetes-dashboard-5498ccf677-4x7sr 1/1 Running 0 5m
storage-provisioner 1/1 Running 0 5m
I deleted minikube and removed all files under ~/.minikube and reinstalled minikube. Now it is working fine. I did not get the output before but I have attached it after it is working to the question. Can you tell me what does the output of this command tells ?
当您的 Minikube Kubernetes 集群 已经被删除并重新设置时,很难甚至不可能判断它到底出了什么问题。
基本上,您可以采取一些措施来正确解决或调试您的问题。
Adding the command output which was asked in the comments
您发布的输出实际上只是@Eduardo Baitello 要求您完成的任务的一部分。 kubectl get po -n kube-system
命令只是显示 Pods
in kube-system
namespace 的列表。换句话说,这是构成您的 Kubernetes 集群的系统 pods 的列表,正如您可以想象的那样,这些组件中的每一个的正常运行都是至关重要的。正如您在输出中看到的,kube-proxy
pod 的 STATUS
是 Running
:
kube-proxy-7ndvl 1/1 Running 0 5m
@Eduardo 的问题中还要求您检查其日志。你可以通过发出:
kubectl logs kube-proxy-7ndvl
它可以告诉您在问题发生时这个特定的 pod 出了什么问题。此外,在这种情况下,您可以使用 describe
命令查看其他 pod 详细信息(有时查看 pod 事件可能有助于弄清楚它发生了什么):
kubectl describe pod kube-proxy-7ndvl
检查此特定 Pod
状态和日志的建议很可能是受 Minikube 启动过程中显示的错误消息片段的启发:
E0912 17:39:12.486830 17689 start.go:305] Error restarting
cluster: restarting kube-proxy: waiting for kube-proxy to be
up for configmap update: timed out waiting for the condition
如您所见,此消息清楚地表明 "something wrong" 与 kube-proxy
之间存在简短关系,因此首先检查它很有意义。
还有一件事你可能没有注意到:
kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube LoadBalancer 10.102.236.236 <pending> 8080:31825/TCP 15m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 19h
您的 hello-minikube
服务还没有完全准备好。在 EXTERNAL-IP
列中,您可以看到它的状态是 pending
。正如您可以使用 describe
命令来描述 Pods
一样,您可以这样做以获取服务的详细信息。简单:
describe service hello-minikube
在这种情况下可以告诉你很多。
1)If minikube cluster got failed while starting, how did the kubectl able to connect to minikube to do deployments and services? 2) If cluster is fine, then why am i getting connection refused ?
请记住,Kubernetes 集群 不是一个整体结构,它由许多相互依赖的部分组成。 kubectl
工作并且您可以创建部署这一事实并不意味着整个集群工作正常,正如您在错误消息中看到的那样,它暗示其组件之一,即 kube-proxy
,实际上可能无法正常运行。
回到问题的开头...
I have followed the installation instructions provided here https://kubernetes.io/docs/setup/learning-environment/minikube/#using-minikube-with-an-http-proxy
Issue1: After installing kubectl, virtualbox and minikube I have run the command
minikube start --vm-driver=virtualbox
据我所知,您没有使用 http 代理,所以您没有按照您发布的文档的这个特定片段中的说明进行操作,对吗?
我的印象是你混淆了两个概念。 kube-proxy
这是一个 Kubernetes cluster
组件,在 kube-system
space 和 http proxy server mentioned in this 文档片段中部署为 pod。
I was looking at this proxy(https://kubernetes.io/docs/setup/learning-environment/minikube/#starting-a-cluster) what is my_proxy in this ?
如果您不知道您的 http proxy 地址是什么,很可能您根本就没有使用它,如果您不使用它从您的计算机连接到 Internet,它不适用于您的情况。
否则,您需要通过 providing additional flags when you start it 为您的 Minikube 进行如下设置:
minikube start --docker-env http_proxy=http://$YOURPROXY:PORT \
--docker-env https_proxy=https://$YOURPROXY:PORT
如果您能够启动您的 Minikube,现在它仅使用以下命令即可正常工作:
minikube start --vm-driver=virtualbox
你的问题是由其他原因引起的,你不需要提供上面提到的标志来告诉你的 Minikube 你的 http 代理服务器是什么你正在使用.
据我所知,目前一切正常,运行ning,您可以毫无问题地访问命令 minikube service hello-minikube --url
返回的 url,对吗?您还可以 运行 命令 kubectl get service hello-minikube
并检查其输出是否与您之前发布的不同。由于您没有附加任何 yaml 定义文件,因此很难判断您的服务定义是否有问题。另请注意,Load Balancer
是一种服务类型,旨在与云提供商提供的外部负载平衡器一起使用,而 minikube 使用 NodePort
代替它。