0

我正在使用基于 Redhat-SSO 和 Keycloak 的模板 sso72-x509-postgresql-persistent 在 OpenShift 中创建应用程序。

我将启用它的双向 SSL 模式,这样用户在他的请求中只需要提供他的证书而不是用户名和密码。该文档(https://access.redhat.com/documentation/en-us/red_hat_single_sign-on/7.2/html-single/server_administration_guide/index#x509)告诉我编辑standalone.xml文件以添加配置部分。它工作得很好。

但是模板镜像 sso72-x509-postgresql-persistent 在这个过程中存在问题,因为它在 OpenShift 上部署后,docker 内文件的任何更改在 docker 重启后都丢失了。

无论如何,除了制作我自己的 docker 映像之外,是否可以通过命令行或 API 等另一个级别的问题来启用相互 SSL 模式,而不是编辑配置文件?

4

1 回答 1

1

好的,无论如何我都包括这个。由于权限问题,我无法使其正常工作(挂载的文件没有保留与以前相同的权限,因此容器继续失败。但是这个答案做了很多工作,所以希望它能指出你正确的方向!


您可以添加持久卷 (PV) 以确保您的配置更改在重新启动后仍然有效。您可以通过以下方式将 PV 添加到您的部署中:

不要这样做

oc set volume deploymentconfig sso --add -t pvc --name=sso-config --mount-path=/opt/eap/standalone/configuration --claim-mode=ReadWriteOnce --claim-size=1Gi

这将显示带有空白configuration目录的 RH-SSO 映像,导致 pod 卡在Back-off restarting failed container. 你应该做的是:

  1. 备份现有的配置文件

    oc rsync <rhsso_pod_name>:/opt/eap/standalone/configuration ~/
    
  2. 创建一个临时的busybox部署,它可以充当上传配置文件的中介。等待部署完成

    oc run busybox --image=busybox --wait --command -- /bin/sh -c "while true; do sleep 10; done"
    
  3. 将新 PV 挂载到busybox部署中。等待部署完成

    oc set volume deploymentconfig busybox --add -t pvc --name=sso-volume --claim-name=sso-config --mount-path=/configuration --claim-mode=ReadWriteOnce --claim-size=1Gi
    
  4. 立即编辑您的配置文件

  5. busybox通过pod将配置文件上传到新 PV

    oc rsync ~/configuration/ <busybox_pod_name>:/configuration/
    
  6. 销毁busybox部署

    oc delete all -l run=busybox --force --grace-period=0
    
  7. 最后,您将已创建并准备就绪的持久配置附加到 RH SSO 部署

    oc set volume deploymentconfig sso --add -t pvc --name=sso-volume --claim-name=sso-config --mount-path=/opt/eap/standalone/configuration
    

一旦您的新部署......由于权限问题仍然失败:/

于 2019-01-28T22:39:57.180 回答