Unable to access api exposed by istio cluster on AKS. I can see external ip and ports but unable to reach the same

41 Views Asked by At

Followed this example

https://istio.io/latest/docs/examples/bookinfo/ Below is output from istioctl analyze

output of istioctl analyze

output of istioctl anayze

Updated port number and selector as suggested by istioctl tool. But still on dead end

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bookinfo-gateway
spec:
  # The selector matches the ingress gateway pod labels.
  # If you installed Istio using Helm following the standard documentation, this would be "istio=ingress"
  selector:
    istio: ingress # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo
spec:
  hosts:
  - "*"
  gateways:
  - bookinfo-gateway
  http:
  - match:
    - uri:
        exact: /productpage
    - uri:
        prefix: /static
    - uri:
        exact: /login
    - uri:
        exact: /logout
    - uri:
        prefix: /api/v1/products
    route:
    - destination:
        host: productpage
        port:
          number: 9080

1

There are 1 best solutions below

0
Arko On

Hello gera1390 your steps are correct, there is a glitch in the document. I tried the same document shared by you and found the same issue.

Downloaded istio enter image description here

installed Istio enter image description here

added a namespace label

kubectl label namespace default istio-injection=enabled

enter image description here

Deployed in bookinfo sample

kubectl apply -f [samples/bookinfo/platform/kube/bookinfo.yaml](https://raw.githubusercontent.com/istio/istio/release-1.20/samples/bookinfo/platform/kube/bookinfo.yaml)

enter image description here

verified the service and pods

kubectl get services
kubectl get pods

enter image description here

associated the bookinfo with gateway

 kubectl apply -f [samples/bookinfo/networking/bookinfo-gateway.yaml](https://raw.githubusercontent.com/istio/istio/release-1.20/samples/bookinfo/networking/bookinfo-gateway.yaml)

enter image description here

Analyzed it using istioctl analyze enter image description here

Got the external IP

kubectl get svc istio-ingressgateway -n istio-system

enter image description here

Set the ingress IP and ports and exported the gateway url

export GATEWAY_URL=$INGRESS_HOST:$INGRESS_PORT

enter image description here enter image description here

In this entire setup, I made sure there is no firewall enabled, my NSG rules are allowing port 80 and 443 enter image description here

Instead, you can try the below alternative options-

Option 1- localhost approach, I tried using localhost and I was able to access it over the localhost- Deployment process remains the same. You create a cluster. enter image description here

Create a namespace for bookinfo

kubectl create namespace bookinfo

enter image description here

Deploy the application as already shown above enter image description here

Once deployed, verify the pods- enter image description here

Do a port forward using kubectl port-forward -n bookinfo service/productpage 9090 enter image description here

and access it via localhost

enter image description here

Option2- As per this setup Update your /etc/hosts configuration file In your /etc/hosts file, add the previous IP address to the host entries provided by the following command.

echo $(kubectl get ingress istio-system -n istio-system -o jsonpath='{..ip} {..host}') $(kubectl get ingress bookinfo -o jsonpath='{..host}')

You should have a Superuser privilege and probably use sudo to edit /etc/hosts.

and access the application’s home page from the command line:

kubectl exec $(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}') -c sleep -- curl -sS productpage:9080/productpage | grep -o "<title>.*</title>"

enter image description here

Reference Document-

Bookinfo sample

Getting started with istio