首页 文章

无法进入微服务

提问于
浏览
0

运用

  • minikube 0.23

  • kubectl 1.8x

  • istio 0.2.10

启用自动边车注入并启动minikube与所有正确的插件

minikube start --vm-driver=xhyve --extra-config=apiserver.Admission.PluginNames="Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,GenericAdmissionWebhook,ResourceQuota" --kubernetes-version=v1.7.5

我看到侧面的汽车沿着微服务 .

NAME                       READY     STATUS    RESTARTS   AGE
microse-598544478f-hs8pv   2/2       Running   2          1d

但是现在启用istio我无法进入患者微服务 .

export GATEWAY_URL=$(kubectl get po -n istio-system -l istio=ingress -o 'jsonpath={.items[0].status.hostIP}'):$(kubectl get svc istio-ingress -n istio-system -o 'jsonpath={.spec.ports[0].nodePort}')

curl -iv -H "Content-Type: application/json" -X PUT $GATEWAY_URL -d '{"firstField":"firstData"}'

我得到以下内容:

* Rebuilt URL to: 192.168.64.4:31496/
*   Trying 192.168.64.4...
* TCP_NODELAY set
* Connected to 192.168.64.4 (192.168.64.4) port 31496 (#0)
> PUT / HTTP/1.1
> Host: 192.168.64.4:31496
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 84
> 
* upload completely sent off: 84 out of 84 bytes
< HTTP/1.1 404 Not Found
HTTP/1.1 404 Not Found
< date: Fri, 03 Nov 2017 13:53:31 GMT
date: Fri, 03 Nov 2017 13:53:31 GMT
< server: envoy
server: envoy
< connection: close
connection: close
< content-length: 0
content-length: 0

< 
* Closing connection 0

没有istio,我没有问题做这个PUT . 谢谢你的帮助 .

1 回答

  • 0

    您是否为您的服务创建了Ingress资源?你需要这样的东西:

    cat <<EOF | kubectl apply -f -
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: gateway
      annotations:
        kubernetes.io/ingress.class: "istio"
    spec:
      rules:
      - http:
          paths:
          - path: /.*
            backend:
              serviceName: <your service name>
              servicePort: <your service port>
    EOF
    

相关问题