I have a rest service deployed in K8S. This service is only to be accessed inside the cluster, so it is a ClusterIP service. However I still want to access the generated swagger docs externally. What is the correct way to expose only the docs route?
Make an ingress route exactly matching your swagger url and expose it.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress
spec:
rules:
- host: swagger.example.com
http:
paths:
- path: /swagger.html
backend:
serviceName: backend-svc
servicePort: backend-svc-port