Integrating Keycloak with my application in K8S

1/28/2019

I have two services running in a pod.The one is Keycloak and the other one is my application that will use keycloak for Authentication.
So how i am going to redirect to keycloak, as the keycloak External IP will be generated on the fly?Once the container will spin up that only I can have the Keycloak url.How should I feed this data to my application?
Is there some way we can do this ?

-- Avinash Kumar
keycloak
kubernetes

1 Answer

1/28/2019

On a high level, assuming your application is some sort of frontend UI and you want a user to be redirected to keycloak for login, you will have to do certain things. First, both keycloak and your application must be publicly accessible. This is normally done using an ingress resource. The ingress will map a domain to a service. In your case you will need two ingress resources, one for your app and one for keycloak. Both your app and keycloak must be exposed with service resources.

So, you will have ingress pointing to a service pointing to a port on a pod. Then you can configure the upstream keycloak URL in your application (pod).

-- Helgi
Source: StackOverflow