curl: (7) Failed to connect to 192.168.99.100 port 30790: Connection refused

6/17/2019

I am working on a tutorial on Create a Kubernetes service to point to the Ambassador deployment.

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

On running the command

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

I'm getting error

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

I can actually remove the error of

curl: (3) <url> malformed

by running

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

and then

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

I've already tried this answer curl: (7) Failed to connect to 192.168.99.100 port 31591: Connection refused also the step mentioned in this answer is already in the blog, and it didn't work.

This is the code from the blog, for 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

Can this be a problem related to VM?

Also, I tried to work on this tutorial first but unfortunately, got the same error.

Let me know if anything else is needed from my side.

Edit:

1.As asked in the comment here is the output of

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

after running

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
-- Alohomora
ambassador
kubectl
kubernetes
minikube

1 Answer

6/18/2019

kubectl get pods --namespace=kube-system should have the network service pod

So you have not set up networking policy to used for DNS.

Try using Network Policy Calico by using command

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

check now kubectl get pods --namespace=kube-system

You should get output like this :-

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
-- Dhanraj
Source: StackOverflow