Istio + minikube + Nginx (React). Cannot get access from browser nor CURL

12/16/2019

When I deploy without ingress-gateway I can get access via port-forwarding directly to LoadBalancer of application in the browser. But through ingress-gateway it not working. Sidecars injection is enabled!

Istio v1.4.0
Minukube v1.5.2
Kubernetes v1.16.0

Istio instalation:

istioctl manifest apply \
  --set values.global.mtls.enabled=false \
  --set values.tracing.enabled=true \
  --set values.kiali.enabled=true \
  --set values.grafana.enabled=true \
--namespace istio-system

Than deploy React with NGINX.

# Frontend service
apiVersion: v1
kind: Service
metadata:
  name: front-web
  namespace: demo
spec:
  type: NodePort
  selector:
    app: front-web
  ports:
    - name: http
      port: 80

---
# Frontend app
apiVersion: apps/v1
kind: Deployment
metadata:
  name: front-web
  namespace: demo
  labels:
    app: front-web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: front-web
  template:
    metadata:
      labels:
        app: front-web
    spec:
      containers:
      - name: front-web
        image: sergeygreat/front-web:v1.0.3
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80

Gateway

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: demo-gw
  namespace: demo
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: demo-vs
  namespace: demo
spec:
  hosts:
  - "*"
  gateways:
  - demo-gw
  http:
  - match:
    - uri:
        exact: /
    route:
    - destination:
        port:
          number: 80
        host: front-web.default.svc.cluster.local  # <- tryed just `front-web`, no luck
>> kubectl get svc -n istio-system

istio-ingressgateway LoadBalancer 10.104.158.110 <pending> 80:31332/TCP,...

Everything is running but no access via http://minikube ip:31332 ???

For port 80 in browser: http://minikube_ip - 404 Not Found openresty/1.15.8.2
For port 31332 in browser: http://minikube_ip:31332 - 503 Error

minikube ssh

$ curl -i http://localhost:31332
HTTP/1.1 503 Service Unavailable
date: Mon, 16 Dec 2019 16:04:32 GMT
server: istio-envoy
content-length: 0

$ curl -i http://192.168.99.101:31332
HTTP/1.1 503 Service Unavailable
date: Mon, 16 Dec 2019 16:04:45 GMT
server: istio-envoy
content-length: 0

Can please someone help?

-- Sergey Kozlovskiy
istio
kubernetes
minikube

2 Answers

12/17/2019

Try to recreate minikube:

>>minikube stop
>>minikube delete
>>minikube start --memory=16384 --cpus=4 --vm-driver=virtualbox --kubernetes-version=v1.16.0

If not help try to bind to another port:

- Deployment set to 80
- Service type should be NodePort and bind it to port 8080 targetPort:80
- VirtualService host "*" port 8080

It should work!

If not try to remove this part from VirtualService:

- match:
    - uri:
        exact: /
-- SergeyGreat
Source: StackOverflow

12/16/2019

If you using nginx ingress below are the steps. I would assume there is similar way to enable istio ingress

minikube addons enable ingress

Check you ingress controller is running by verify output of below command

kubectl get pods -n kube-system
nginx-ingress-controller-5984b97644-rnkrg   1/1       Running   0          1m

Expose the service as nodeport. Below is example command

kubectl expose deployment web --target-port=8080 --type=NodePort

kubectl get service web
web       NodePort   10.104.133.249   <none>        8080:31637/TCP   12m

Then get the minikube url

minikube service web --url
http://172.17.0.15:31637
-- Shambu
Source: StackOverflow