0
votes

I have a demo app for testing the local docker, Local Kubernetes and Istio setup. I expose the demo service as type=NodePort initially and it works fine on http://localhost:<NodePort#> without Istio. Then, I tried installing Istio and configured the service as ClusterIP, and exposed it via the Istio-IngressGateway and VirtualService, the basic configuration is inline :

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: demo-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: demoservice
spec:
  hosts:
  - "*"
  gateways:
  - demo-gateway
  http:
  - route:
    - destination:
        host: demo-service
        port:
          number: 80

Post deploying this, navigating to http://localhost/ gives an HTTP 404 error. The Service, VS, Gateway everything looks fine on the cluster. As I am new to this, I am not sure if I am missing something basic here with Istio or Kubernetes.

1
Have you configured your istio-ingress gateway as NodePort or LoadBalancer? Not sure why you try to curl localhost, you should use external IP of your istio-ingress gateway, you can check it with kubectl get svc istio-ingressgateway -n istio-system. Could you try with that and let me know if that work if you use it instead of localhost?Jakub
The gateway is configured as a LoadBalancer, and as I have done a local setup, I see localhost as my external IP. Is this not supposed to be localhost? istio-ingressgateway LoadBalancer 10.107.132.159 localhost 15020:32390/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:30203/TCP,15030:30367/TCP,15031:31417/TCP,15032:30133/TCP,15443:30576/TCP 10hJim
I´m not sure what you mean by local cluster as you specify aks here, to be honest I have never seen this on cloud(aks), usually only on local environment like minikube or dind, personally I used metallb then instead of localhost. Could you try to deploy istio bookinfo application and check if it works?Jakub
Thanks for pointing that out, I edited to remove AKS as currently I am deploying on my local cluster (desktop). I tried using minikube too, but when I tried to enable the Ingress Addon, It threw an error which I think is a known issue : " Due to docker networking limitations on windows, ingress addon is not supported for is driver. github.com/kubernetes/minikube/issues/7332"Jim

1 Answers

0
votes

Configuration for istio-ingressgateway and virtualservice looks fine. IstioByExample (link) has several examples of using istio in various usecases.

Since you are getting 404 while trying to access service locally, I would suspect that istio sidecar is not installed in the service itself. Istio has configuration to enable automatic sidecar deployment (link) which installs sidecar whenever new pod is deployed. I would also suggest you to go through the book sample (link) to understand various components to it.

Some snippets from sample are

To enable sidecar injection - use

$ kubectl label namespace default istio-injection=enabled

Perform the deployment again once the sidecar injection is enabled as it would work from subsequent deployments (not previously deployed)

Please comment here if this works or does not work so that I could try to see what else might be causing issue.