博客
关于我
OpenShift 4 之使用https协议访问Route
阅读量:330 次
发布时间:2019-03-04

本文共 852 字,大约阅读时间需要 2 分钟。

在OpenShift 4.6环境中配置HTTPS访问服务的步骤如下:

  • 部署测试应用

    首先,使用oc命令创建一个新的项目并部署一个测试应用:

    oc new-project https  oc new-app openshift/hello-openshift
  • 获取应用的FQDN

    生成适用于该应用的完全限定域名(FQDN):

    HELLO_HOSTNAME=$(oc get ingresscontroller default -n openshift-ingress-operator -o jsonpath='{.status.domain}')
  • 创建SSL证书和私钥

    根据FQDN生成符合证书要求的SSL密钥和证书。确保FQDN不超过64个字符:

    openssl req -newkey rsa:4096 -nodes -sha256 -keyout example.key -x509 -days 365 -out example.crt -subj "/C=CN/ST=BEIJING/L=BJ/O=REDHAT/OU=IT/CN=${HELLO_HOSTNAME}"
  • 创建支持HTTPS的Route

    使用oc命令创建Route,并指定FQDN、证书和私钥:

    oc create route edge --service=hello-openshift --hostname=${HELLO_HOSTNAME} --key=example.key --cert=example.crt
  • 测试HTTPS访问

    使用curl命令验证HTTPS访问:

    curl --cacert example.crt https://$(oc get route hello-openshift -o template --template '{.spec.host}')
  • 注意事项:

    • 确保FQDN不超过64个字符,否则会导致错误。
    • 证书和私钥文件名应与实际文件名相符。
    • 测试访问时,确保使用生成的证书和私钥以进行验证。

    转载地址:http://relh.baihongyu.com/

    你可能感兴趣的文章
    python3+requests+unittest实战系列【一】
    查看>>
    python3+requests+unittest实战系列【二】
    查看>>
    Python3+Requests+Unittest实战系列【二】
    查看>>
    python3----ASCII
    查看>>
    Python3-selenium自动化测试框架,结合HTMLTestRunner测试报告!
    查看>>
    Python3-如何自我更新作为服务运行的应用程序
    查看>>
    Python3.1-网格模拟概念性问题
    查看>>
    Python3.12 解决conda环境libstdc++版本过低问题
    查看>>
    python3.2批量查询IP地址区域
    查看>>
    Python3.5中协程和未来/任务之间的区别?
    查看>>
    python3.5实现socket通讯(TCP)
    查看>>
    python3.6 ubuntu部署nginx、 uwsgi、 django
    查看>>
    Python3.6.3中,functools似乎不能用
    查看>>
    python3.6.5+cuda9+cudnn7.1+win10+tensorflow-gpu1.9.0下载配置
    查看>>
    python3.6使用pickle序列化class
    查看>>
    python3.6入门到高阶(全栈) day027 网络通信协议 osi七层模型
    查看>>
    Python3.6属性错误:模块‘;异步没有属性‘;运行‘;
    查看>>
    python3.6版本中的python-weka-wrapper安装失败,错误代码为%1
    查看>>
    Python3.7安装cv2踩过的坑
    查看>>
    python写txt文件
    查看>>