Docket Desktop and Istio unable to access endpoint on MAC OS

Viewed 26

I am trying to work on sample project for istio. I have two apps demo1 and demo2.

demoapp Yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-1-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo-1-app
  template:
    metadata:
      labels:
        app: demo-1-app
    spec:
      containers:
        - name: demo-1-app
          image: muzimil:demo-1
          ports:
            - containerPort: 8080
          imagePullPolicy: Never
---

apiVersion: v1
kind: Service
metadata:
  name: demo-1-app
spec:
  selector:
    app: demo-1-app
  ports:
    - port: 8080
      name: http

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: demo-1-app
  labels:
    account: demo-1-app
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-2-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo-2-app
  template:
    metadata:
      labels:
        app: demo-2-app
    spec:
      containers:
        - name: demo-2-app
          image: muzimil:demo2-1
          ports:
            - containerPort: 8080
          imagePullPolicy: Never
---

apiVersion: v1
kind: Service
metadata:
  name: demo-2-app
spec:
  selector:
    app: demo-2-app
  ports:
    - port: 8080
      name: http

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: demo-2-app
  labels:
    account: demo-2-app

And My gateway os this

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: demo-app-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: demo-service1
spec:
  hosts:
  - "*"
  gateways:
  - demo-app-gateway
  http:
  - match:
    - uri:
        exact: /demo1
    route:
    - destination:
        host: demo-1-app
        port:
          number: 8080
  - match:
    - uri:
        exact: /demo2
    route:
    - destination:
        host: demo-2-app
        port:
          number: 8080

I tried to hit url with localhost/demo1/getDetails both 127.0.0.1/demo1/getDetails

But I am getting always 404

istioctl analyse does not give any errors.

1 Answers

To access the application - either change istio-ingressgateway service to NodePort or do port forwarding for the istio ingress gateway service. Edit the istio-ingressgateway service to change the service type.

type: NodePort

K8s will give a node port then you can provide the same nodeport values in istio gateway.

  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: <nodeportnumber>
      name: http
      protocol: HTTP
Related