Not able to open swagger documentation in gcp ingress

11/13/2019

I have created a simple flask api with swagger integration using flask_restplus library. It is working fine in localhost. But when I use it in gcp kubernetes ingress, it is giving results for endpoints but not able to show the documentation or swagger ui. Here are the browser console errors browser console errors

Here is ingress.yml file

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-restplustest
  annotations:
    
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
    kubernetes.io/ingress.global-static-ip-name: "web-static-ip"
spec:
  rules:
  - http:
      paths:
      - path: /rt
        backend:
          serviceName: restplustest
          servicePort: 5000

In local system localhost:5000/rt shows the swagger-ui

-- Harhaaakr
flask-restplus
google-cloud-platform
google-kubernetes-engine
kubernetes
kubernetes-ingress

1 Answer

11/13/2019

Your endpoint return a script that references other scripts located on /swaggerui/* but that path is not defined in your Ingress.

It may be solved if you add that path to your service as well

  - path: /swaggerui/*
    backend:
      serviceName: restplustest
      servicePort: 5000
-- Jonas
Source: StackOverflow