Istio tls port 443 gives 503 Service Unavailable

10/16/2019

I am running a service on kubernetes Azure AKS Cluster.

Istio-version: 1.3.2

My service is listening to both port 80 and 443:

NAME               TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)          AGE
hello-kubernetes   ClusterIP   10.0.43.233   <none>        80/TCP,443/TCP   28h

Also istio-gateway.yaml file looks like below:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: my-gateway
spec:
  selector:
    istio: ingressgateway 
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
    #tls:
      #httpsRedirect: true
  - port:
      number: 443
      name: https
      protocol: HTTPS
    hosts:
    - "*"
    tls:
      mode: SIMPLE
      credentialName: "mycert" # must be the same as secret
      privateKey: sds
      serverCertificate: sds
      #serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
      #privateKey: /etc/istio/ingressgateway-certs/tls.key

The secret is created by below command- I have a custom certificate that I have uploaded on the cluster:

kubectl create -n istio-system secret generic mycert \
  --from-file=key=/home/user/istio-1.3.2/ssl/myprivate.key \
  --from-file=cert=/home/user/istio-1.3.2/ssl/mycert.pem

mycert.pem file includes both certificate key and intermediate key.

The VirtualService file is like:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: hello-kubernetes
spec:
  hosts:
  - "mydomain.com"
  gateways:
  - my-gateway
  http:
  - match:
    - uri:
        prefix: /hello-k8s
    route:
    - destination:
        host: hello-kubernetes

If I curl it with http, it give me 200 OK response however when I curl it with https port, it gives HTTP/1.1 503 Service Unavailable.

Error message on the browser is: NET::ERR_CERT_AUTHORITY_INVALID

Any idea of what it is missing?

-- Matrix
azure-aks
https
istio
kubernetes

1 Answer

10/17/2019

The error is fixed by adding:

port:
   number: 80

in destination part of virtual service file.

-- Matrix
Source: StackOverflow