I'm developing an app (Springboot) where i use my own Oauth autorization server, this server is deployed in AWS, but i want my app to be deployed in a kubernetes environment. The thing is that after creating a pod with my app image and a service for the pod i'm struggling with the oauth authentication. I have an enviroment variable defined for a production profile which sets the redirect url (http://localhost:8002/module) but this url is not correct now. The redirect should be done to the minikube machine and then proxy it to the minikube ip and the service assigned port. Is there anyway to achieve this? What approach should i follow?
The pod:
apiVersion: v1
kind: Pod
metadata:
name: tmanager-module-webapp
labels:
version: beta
release: "Beta"
spec:
containers:
- name: module
image: tmanager-module
imagePullPolicy: "Never"
And the service:
kind: Service
apiVersion: v1
metadata:
name: tmanager-module-webapp
spec:
selector:
version: beta
ports:
- name: http
port: 8002
nodePort: 30080
type: NodePort
Thanks in advance
Cluster IPs are private to the kubenetes cluster. So the authorization server in AWS which is outside the kubernetes cluster can not access it and redirect to it. You need to expose the spring boot app in Kubernetes via NodePort or Loadbalancer service.
I solve it using the kubernetes port forward, but i had to point the deployment instead of the service https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/ that way i could access the target machine and port and point the oauth redirection to it. Independently of the pod ip and port.