简体   繁体   English

Oauth Kubernetes 重定向

[英]Oauth kubernetes redirect

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.我正在开发一个应用程序 (Springboot),我使用我自己的 Oauth 自动化服务器,该服务器部署在 AWS 中,但我希望我的应用程序部署在 kubernetes 环境中。 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.问题是,在使用我的应用程序映像和 pod 服务创建一个 pod 之后,我正在为 oauth 身份验证而苦苦挣扎。 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.我为生产配置文件定义了一个环境变量,它设置了重定向 url ( http://localhost:8002/module ),但这个 url 现在不正确。 The redirect should be done to the minikube machine and then proxy it to the minikube ip and the service assigned port.重定向应该在 minikube 机器上完成,然后将其代理到 minikube ip 和服务分配的端口。 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提前致谢

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.我使用 kubernetes 端口转发解决了它,但我必须以这种方式指向部署而不是服务https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/我可以访问目标机器和端口,并将 oauth 重定向指向它。 Independently of the pod ip and port.独立于 pod ip 和端口。

Cluster IPs are private to the kubenetes cluster.集群 IP 是 kubenetes 集群私有的。 So the authorization server in AWS which is outside the kubernetes cluster can not access it and redirect to it.所以 AWS 中位于 kubernetes 集群之外的授权服务器无法访问它并重定向到它。 You need to expose the spring boot app in Kubernetes via NodePort or Loadbalancer service.您需要通过 NodePort 或 Loadbalancer 服务在 Kubernetes 中公开 Spring Boot 应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM