curl:(7)无法连接到192.168.99.100端口30790:连接被拒绝

时间:2019-06-17 12:31:42

标签: kubernetes kubectl minikube ambassador

我正在研究有关创建Kubernetes服务以指向大使部署的教程。

教程:https://www.bogotobogo.com/DevOps/Docker/Docker-Envoy-Ambassador-API-Gateway-for-Kubernetes.php

运行命令

curl $(minikube service --url ambassador)/httpbin/ip

我遇到错误

curl: (7) Failed to connect to 192.168.99.100 port 30790: Connection refused
curl: (3) <url> malformed 

我实际上可以消除错误

curl: (3) <url> malformed

通过运行

minikube service --url ambassador
http://192.168.99.100:30790

然后

curl http://192.168.99.100:30790/httpbin/ip

我已经尝试过此答案curl: (7) Failed to connect to 192.168.99.100 port 31591: Connection refused,并且此答案中提到的步骤已经在博客中,并且无效。

这是博客中ambassador-svc.yaml的代码

---
apiVersion: v1
kind: Service
metadata:
  labels:
    service: ambassador
  name: ambassador
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  httpbin_mapping
      prefix: /httpbin/
      service: httpbin.org:80
      host_rewrite: httpbin.org
spec:
  type: LoadBalancer
  ports:
  - name: ambassador
    port: 80
    targetPort: 80
  selector:
    service: ambassador

这可能是与VM有关的问题吗?

此外,我首先尝试着研究this教程,但不幸的是,遇到了同样的错误。

让我知道我身边是否还有其他需要。

编辑:

1。如评论中所要求的那样,是

的输出
kubectl get pods --namespace=kube-system
NAME                               READY   STATUS    RESTARTS   AGE
coredns-fb8b8dccf-qkxwm            1/1     Running   0          5h16m
coredns-fb8b8dccf-rrn4f            1/1     Running   0          5h16m
etcd-minikube                      1/1     Running   0          5h15m
kube-addon-manager-minikube        1/1     Running   4          5h15m
kube-apiserver-minikube            1/1     Running   0          5h15m
kube-controller-manager-minikube   1/1     Running   0          3h17m
kube-proxy-wfbxs                   1/1     Running   0          5h16m
kube-scheduler-minikube            1/1     Running   0          5h15m
storage-provisioner                1/1     Running   0          5h16m

运行后

kubectl apply -f https://docs.projectcalico.org/v3.7/manifests/calico.yaml
NAME                                       READY   STATUS    RESTARTS   AGE
calico-kube-controllers-78f8f67c4d-zqtl2   1/1     Running   0          65s
calico-node-27lcq                          1/1     Running   0          65s
coredns-fb8b8dccf-qkxwm                    1/1     Running   2          22h
coredns-fb8b8dccf-rrn4f                    1/1     Running   2          22h
etcd-minikube                              1/1     Running   1          22h
kube-addon-manager-minikube                1/1     Running   5          22h
kube-apiserver-minikube                    1/1     Running   1          22h
kube-controller-manager-minikube           1/1     Running   0          8m27s
kube-proxy-wfbxs                           1/1     Running   1          22h
kube-scheduler-minikube                    1/1     Running   1          22h
storage-provisioner                        1/1     Running   2          22h

1 个答案:

答案 0 :(得分:1)

kubectl获取容器--namespace = kube-system 应该具有网络服务容器

因此,您尚未设置要用于DNS的网络策略。

尝试使用网络策略Calico  通过使用命令

kubectl apply -f https://docs.projectcalico.org/v3.7/manifests/calico.yaml

立即检查 kubectl获取容器--namespace = kube-system

您应该得到这样的输出:-

NAMESPACE    NAME                                       READY  STATUS   RESTARTS  AGE
kube-system  calico-kube-controllers-6ff88bf6d4-tgtzb   1/1    Running  0         2m45s
kube-system  calico-node-24h85                          1/1    Running  0         2m43s
kube-system  coredns-846jhw23g9-9af73                   1/1    Running  0         4m5s
kube-system  coredns-846jhw23g9-hmswk                   1/1    Running  0         4m5s
kube-system  etcd-jbaker-1                              1/1    Running  0         6m22s
kube-system  kube-apiserver-jbaker-1                    1/1    Running  0         6m12s
kube-system  kube-controller-manager-jbaker-1           1/1    Running  0         6m16s
kube-system  kube-proxy-8fzp2                           1/1    Running  0         5m16s
kube-system  kube-scheduler-jbaker-1                    1/1    Running  0         5m41s