SovereignCloudStack / issues

This repository is used for issues that are cross-repository or not bound to a specific repository.
https://github.com/orgs/SovereignCloudStack/projects/6
2 stars 1 forks source link

Deploy Keycloak via k3s on the management plane #507

Closed reqa closed 8 months ago

reqa commented 11 months ago

We should deploy Keycloak via k3s on the management plane.

This is basically a concrete example of #249.

Definition of Ready:

Definition of Done:

JuanPTM commented 11 months ago

This is currently working on the testbed. The deployment has been done using CloudNative-PG and codecentric Keycloakx.

reqa commented 11 months ago

@berendt I guess this would be two ansible roles, one for postgresql deployment and an updated one for keycloak (see https://input.scs.community/2023-scs-sig-iam ). Should they also be put into osism/ansible-collection-services and be consumed by ansible-playbooks/playbooks/infrastructure-keycloak.yml ?

garloff commented 10 months ago

k3s now runs on control nodes and management node, we can deploy it on multiple nodes now. Next steps:

reqa commented 10 months ago

Manual progress:

reqa commented 10 months ago

This looks interesting: https://github.com/helm/charts/issues/10192#issuecomment-647481786

reqa commented 10 months ago

Current deployment steps:

# 1. Deploy CloudNativePG operator:
helm repo add cnpg https://cloudnative-pg.github.io/charts
helm upgrade --install cnpg  --namespace cnpg-system --create-namespace cnpg/cloudnative-pg

# 2. Create DB for Keycloak
kubectl create namespace keycloak
kubectl apply -f pg.yaml --namespace keycloak

# 3. Deploy Keycloak
helm repo add codecentric https://codecentric.github.io/helm-charts
helm install keycloakx codecentric/keycloakx --namespace keycloak --values keycloakx-with-service-loadBalancer.yaml

The yaml files we used for the PoC:

reqa commented 9 months ago

@berendt

reqa commented 9 months ago

My proposal would be to simply adjust https://github.com/osism/ansible-collection-services/tree/main/roles/keycloak to deploy to k3s using a combination of https://docs.ansible.com/ansible/latest/collections/kubernetes/core/helm_module.html and https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_module.html .

That way we could create a cloudnativepg role there and let keycloak depend on that.

reqa commented 9 months ago

Current state: https://github.com/reqa/ansible-collection-services/commits/reqa/issue-507/

All theoretical, untested. The credential handling+passing to k3s still needs to be fixed. I'm using the traefik_certificates from the secrets.yml generated in the control/ownca.

reqa commented 8 months ago

Works now with