2

I am trying to understand the Kubernetes API Gateway for my Microservices. I have multiple microservices and those are deployed with the Kubernetes deployment type along with its own services. I also have a front-end application that basically tries to communicate with the above APIs to complete the requests. Overall, below is something I like to achieve and I like your opinions.

  1. Is my understanding correct with the below diagram? (like Should we have API Gateway on top of all my Microservices and Web Application should use this API Gateway to reach any of those services?
  2. If yes, How can I make that possible? I mean, I tried ISTIO Gateway and that's somehow not working. enter image description here

Here is istio gateway and virtual service

enter image description here

On another side, below is my service (catalog service) configuration

apiVersin: v1
kind: Service
metadata: 
  name: catalog-api-service
  namespace: local-shoppingcart-v1
  labels: 
    version: "1.0.0"
spec:
  type: NodePort
  selector:
    app: catalog-api
  ports: 
  - nodePort: 30001
    port: 30001
    targetPort: http
    protocol: TCP
    name: http-catalogapi

also, at the host file (windows - driver\etc\host file) I have entries for the local DNS

127.0.0.1 kubernetes.docker.internal
127.0.0.1 localshoppingcart.com

istio service side, following screenshot

enter image description here

I am not sure what is going wrong but I try localhost:30139/catalog or localhost/catalog it always gives me connection refuse or connection not found error only.

Brijesh Shah
  • 573
  • 6
  • 18
  • Please provide more information about your current setup - which Kubernetes version are you using, which solution did you use to setup a cluster (kubeadm or some cloud provider solution etc.). – Bazhikov Nov 30 '21 at 12:48

1 Answers1

0

If you are on the minikube you have to get the IP of minikube and port using these command as mentioned in the document

Get IP of minikube

export INGRESS_HOST=$(minikube ip)

Document

You can get Port and HTTPS port details

export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].nodePort}')

If you are on Docker Desktop try forwarding traffic using the kubectl

kubectl port-forward svc/istio-ingressgateway 8080:80 -n istio-system

Open

localhost:8080 in browser

Read more

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • unfortunately, it's not working. it's giving connection refused. I am having docker desktop and the istio service is type loadbalancer. – Brijesh Shah Nov 28 '21 at 19:40