Unable to establish connection with minikube cluster from host

时间:2017-04-10 00:35:24

标签: curl networking kubernetes minikube virtual-network

I am following this fission tutorial on a remote bare metal instance. When I run curl $FISSION_URL (http://192.168.42.152:31313) it does not return. I ran the following commands:

  1. sudo lsof -i | grep 192.168.42.152.

ntpd 2860 ntp 32u IPv4 55241 0t0 UDP 192.168.42.1:ntp

dnsmasq 3392 libvirt-dnsmasq 5u IPv4 33870 0t0 UDP 192.168.42.1:domain

dnsmasq 3392 libvirt-dnsmasq 6u IPv4 33871 0t0 TCP 192.168.42.1:domain (LISTEN)

  1. curl -vvv $FISSION_URL.

Rebuilt URL to: http://192.168.42.152:31313/

Trying 192.168.42.152...

Connected to 192.168.42.152 (192.168.42.152) port 31313 (#0)

GET / HTTP/1.1

Host: 192.168.42.152:31313

User-Agent: curl/7.47.0

Accept: /

  1. sudo iptables -L

    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination         
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps
    ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination         
    DOCKER-ISOLATION  all  --  anywhere             anywhere            
    DOCKER     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
    ACCEPT     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             anywhere            
    ACCEPT     all  --  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
    ACCEPT     all  --  192.168.122.0/24     anywhere            
    ACCEPT     all  --  anywhere             anywhere            
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
    ACCEPT     all  --  anywhere             anywhere            
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
    REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination         
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc
    ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootpc
    Chain DOCKER (1 references)
    target     prot opt source               destination         
    Chain DOCKER-ISOLATION (1 references)
    target     prot opt source               destination                 
    
    RETURN     all  --  anywhere             anywhere     
    

I am unsure on how I should proceed with debugging this. I believe the host is able to connect with the guest (minikube IP) but unable to retrieve data. Can anyone guide me on how to fix this?

1 个答案:

答案 0 :(得分:1)

启动minikube实例并运行doc中提供的

命令
kubectl create -f http://fission.io/fission.yaml
kubectl create -f http://fission.io/fission-nodeport.yaml

然后运行以下设置kubernetes上下文

kubectl config set-context minikube --namespace fission

现在要运行当前部署的状态,请发布以下命令的输出:

kubectl get pods -o wide
kubectl get svc -o wide
kubectl get events 

对我而言,它正在发挥作用:

$ export FISSION_URL=http://$(minikube ip):31313
$ curl $FISSION_URL
{"message": "Fission API", "version": "0.1.0"}

我的州看起来像这样:

$ kubectl get pods -o wide
NAME                           READY     STATUS    RESTARTS   AGE       IP           NODE
controller-1637203237-g5lw1    1/1       Running   0          16m       172.17.0.6   minikube
etcd-2122244727-6vl4v          1/1       Running   0          16m       172.17.0.8   minikube
kubewatcher-2300228496-7kbw3   1/1       Running   1          16m       172.17.0.7   minikube
poolmgr-3531518326-nsxmr       1/1       Running   3          16m       172.17.0.5   minikube
router-2621354073-q1hw7        1/1       Running   3          16m       172.17.0.4   minikube

$ kubectl get svc -o wide
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)        AGE       SELECTOR
controller   10.0.0.191   <nodes>       80:31313/TCP   15m       svc=controller
etcd         10.0.0.41    <none>        2379/TCP       16m       svc=etcd
poolmgr      10.0.0.252   <none>        80/TCP         16m       svc=poolmgr
router       10.0.0.108   <nodes>       80:31314/TCP   15m       svc=router

且事件为here