• RHCA之路---EX280(6)


    RHCA之路—EX280(6)

    1. 题目

    在这里插入图片描述
    Create an application greeter in the project samples
    which uses the Docker image registry.lab.example.com/openshift/hello-openshift
    so that it is reachable at the following address only: https://greeter.apps.lab.example.com
    (Note you can use the script http://materials.example.com/exam280/gencert.sh to generate the necessary certificate files.)

    2. 解题

    2.1 切换项目

    [root@master farm]# oc project samples
    Now using project "samples" on server "https://master.lab.example.com".
    [root@master farm]# mkdir ~/samples
    [root@master farm]# cd ~/samples
    [root@master samples]# oc projects
    You have access to the following projects and can switch between them with 'oc project ':
    
        default
        ditto
        farm
        kube-public
        kube-service-catalog
        kube-system
        logging
        management-infra
        openshift
        openshift-ansible-service-broker
        openshift-infra
        openshift-node
        openshift-template-service-broker
        openshift-web-console
        rome
      * samples
        shrimp
    
    Using project "samples" on server "https://master.lab.example.com".
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26

    2.2 创建app

    [root@master samples]# oc new-app --docker-image=registry.lab.example.com/openshift/hello-openshift --name=greeter
    --> Found Docker image 7af3297 (5 years old) from registry.lab.example.com for "registry.lab.example.com/openshift/hello-openshift"
    
        * An image stream will be created as "greeter:latest" that will track this image
        * This image will be deployed in deployment config "greeter"
        * Ports 8080/tcp, 8888/tcp will be load balanced by service "greeter"
          * Other containers can access this service through the hostname "greeter"
    
    --> Creating resources ...
        imagestream "greeter" created
        deploymentconfig "greeter" created
        service "greeter" created
    --> Success
        Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
         'oc expose svc/greeter'
        Run 'oc status' to view your app.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    2.3 准备https配置文件

    [root@master samples]# wget http://materials.example.com/exam280/gencert.sh
    --2023-09-04 16:07:54--  http://materials.example.com/exam280/gencert.sh
    Resolving materials.example.com (materials.example.com)... 172.25.254.254
    Connecting to materials.example.com (materials.example.com)|172.25.254.254|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 338 [application/x-sh]
    Saving to: ‘gencert.sh’
    
    100%[===========================================================================================================>] 338         --.-K/s   in 0s
    
    2023-09-04 16:07:54 (56.9 MB/s) - ‘gencert.sh’ saved [338/338]
    
    [root@master samples]# chmod +x gencert.sh
    [root@master samples]# ./gencert.sh greeter.apps.lab.example.com
    Generating a private key...
    Generating RSA private key, 2048 bit long modulus
    ..............+++
    ............+++
    e is 65537 (0x10001)
    
    Generating a CSR...
    
    Generating a certificate...
    Signature ok
    subject=/C=US/ST=NC/L=Raleigh/O=RedHat/OU=RHT/CN=greeter.apps.lab.example.com
    Getting Private key
    
    DONE.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    2.4 配置https路由

    [root@master samples]# oc create route edge --service=greeter \ 
    --hostname=greeter.apps.lab.example.com \
    --key=greeter.apps.lab.example.com.key \ 
    --cert=greeter.apps.lab.example.com.crt
    route "greeter" created
    
    • 1
    • 2
    • 3
    • 4
    • 5

    3. 确认

    [root@master samples]# curl -k https://greeter.apps.lab.example.com
    Hello OpenShift!
    
    • 1
    • 2
  • 相关阅读:
    [开发过程]<c#上位机>关于.net6
    「Qt中文教程指南」如何创建基于Qt Widget的应用程序(三)
    HTC使用官方固件作为底包制作rom卡刷包教程
    疯狂小杨哥有意退网
    sqli-labs(Less-3)
    华为机试真题 C++ 实现【TLV解析Ⅰ】
    洛谷P1502 窗口的星星
    五金行业智慧采购解决方案:应用集中采购协同管理系统激活企业数字化采购价值
    全屏 直接用
    数字密码锁verilog设计+仿真+上板验证
  • 原文地址:https://blog.csdn.net/qq_29974229/article/details/132671569