I have a flask application deployed on Cloud Run on Anthos. The endpoint looks like this: http://example.<IP>.xip.io
under service name military-govt-id
. It was deployed successfully on a GKE cluster. Now I want to add Istio Authentication. The problem is that when I try to access the application with a service account with the proper role binding, it gives me an unauthorized access error. I have followed the documentation here [1] and looked through examples here [2], and also contacted Google Cloud Support for assistance. We have isolated the issue and it seems the authenticationpolicy.yaml
file has not been properly written, but they and I don't know which fields are incorrect. Could someone provide assistance with this? We have tried many different combinations, and all of them give the same unauthorized access error when calling the API.
yaml file
apiVersion: authentication.istio.io/v1alpha1
kind: Policy
metadata:
name: default
namespace: api
spec:
origins:
- jwt:
issuer: "https://securetoken.google.com"
audiences:
- "military-govt-id"
jwksUri: "https://www.googleapis.com/oauth2/v3/certs"
jwt_headers:
- "x-goog-iap-jwt-assertion"
principalBinding: USE_ORIGIN
[1] https://cloud.google.com/solutions/authorizing-access-to-cloud-run-on-gke-services-using-istio
[2] https://archive.istio.io/v1.2/docs/reference/config/istio.authentication.v1alpha1/#Jwt