• RHCA之路---EX280(8)


    RHCA之路—EX280(8)

    1. 题目

    在这里插入图片描述
    On master.lab.example.com using the template file in http://materials.example.com/exam280/gogs as a basis,
    install an application in the ditto project according to the following requirements:
    All of the registry entries must point to your local registry at registry.lab.example.com
    The version in the ImageStream line for the postgresql image must be changed from postgresql:9.5 to postgresql:9.2
    For the Gogs pod, use the Docker image from http://materials.example.com/exam280/gogs.tar and make sure it is tagged as registry.lab.example.com/openshiftdemos/gogs:0.9.97 and pushed to your local registry
    Mask the template gogs available across all projects and for all users
    Deploy the appllication using the template, setting the parameter HOSTNAME to gogs.apps.lab.example.com
    Create a user salvo with password redhat and email address salvo@master.lab.example.com on the application frontend
    (use the Register link on the top right of the page at http://gogs.apps.lab.example.com) and, as this user, create a Git repository named ex280
    If there isn’t one already, create a file named README.md in the repository ex280 and put the line faber est quisque fortunae suae in it and commit it.
    The repository must be visible and accessible

    2. 解题

    2.1 切换项目

    [root@master shrimp]# oc project ditto
    Now using project "ditto" on server "https://master.lab.example.com".
    [root@master shrimp]# mkdir ~/ditto
    [root@master shrimp]# cd ~/ditto
    [root@master ditto]# 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 "ditto" 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 创建模板

    2.2.1 下载模板

    [root@master ditto]# wget http://materials.example.com/exam280/gogs/gogs-temp.yaml
    --2023-09-04 16:33:37--  http://materials.example.com/exam280/gogs/gogs-temp.yaml
    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: 10037 (9.8K) [text/plain]
    Saving to: ‘gogs-temp.yaml’
    
    100%[===========================================================================================================>] 10,037      --.-K/s   in 0s
    
    2023-09-04 16:33:37 (285 MB/s) - ‘gogs-temp.yaml’ saved [10037/10037]
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    2.2.3 替换yaml

    [root@master ditto]# sed -ir 's/postgresql:9.5/postgresql:9.2/g' gogs-temp.yaml
    [root@master ditto]# grep gogs: gogs-temp.yaml
            name: services.lab.example.com/openshiftdemos/gogs:0.9.97
    [root@master ditto]# sed -ir 's#services.lab.example.com/openshiftdemos/gogs:0.9.97#registry.lab.example.com/openshiftdemos/gogs:0.9.97#g' gogs-temp.yaml
    
    • 1
    • 2
    • 3
    • 4

    2.2.4 创建template

    [root@master ditto]# oc create -f gogs-temp.yaml -n openshift
    template "gogs" created
    
    • 1
    • 2

    2.3 创建镜像

    [root@master ditto]# wget http://materials.example.com/exam280/gogs.tar
    --2023-09-04 16:38:12--  http://materials.example.com/exam280/gogs.tar
    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: 467157504 (446M) [application/x-tar]
    Saving to: ‘gogs.tar’
    
    100%[===========================================================================================================>] 467,157,504  106MB/s   in 4.7s
    
    2023-09-04 16:38:17 (95.1 MB/s) - ‘gogs.tar’ saved [467157504/467157504]
    
    [root@master ditto]# docker load -i gogs.tar
    34e7b85d83e4: Loading layer [==================================================>] 199.9 MB/199.9 MB
    addf85492fbe: Loading layer [==================================================>] 6.144 kB/6.144 kB
    126a150d0743: Loading layer [==================================================>] 189.6 MB/189.6 MB
    b93687778caa: Loading layer [==================================================>] 77.66 MB/77.66 MB
    Loaded image: openshiftdemos/gogs:latest
    [root@master ditto]# docker tag openshiftdemos/gogs:latest registry.lab.example.com/openshiftdemos/gogs:0.9.97
    [root@master ditto]# docker push registry.lab.example.com/openshiftdemos/gogs:0.9.97
    The push refers to a repository [registry.lab.example.com/openshiftdemos/gogs]
    b93687778caa: Pushed
    126a150d0743: Pushed
    addf85492fbe: Pushed
    34e7b85d83e4: Pushed
    0.9.97: digest: sha256:483a06aac04eb028ae1ddbd294954ba28d7c16b32fc5fca495f37d8e6c9295de size: 1160
    
    • 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.4 根据template创建app

    [root@master ditto]# oc new-app --template=gogs --param=HOSTNAME=gogs.apps.lab.example.com
    --> Deploying template "openshift/gogs" to project ditto
    
         gogs
         ---------
         The Gogs git server (https://gogs.io/)
    
         * With parameters:
            * APPLICATION_NAME=gogs
            * HOSTNAME=gogs.apps.lab.example.com
            * GOGS_VOLUME_CAPACITY=1Gi
            * DB_VOLUME_CAPACITY=2Gi
            * Database Username=gogs
            * Database Password=gogs
            * Database Name=gogs
            * Database Admin Password=605BtU1L # generated
            * Maximum Database Connections=100
            * Shared Buffer Amount=12MB
            * Gogs Version=0.9.97
            * Installation lock=true
            * Skip TLS verification on webhooks=false
    
    --> Creating resources ...
        persistentvolume "gogs-postgres-data" created
        persistentvolume "gogs-data" created
        serviceaccount "gogs" created
        service "gogs-postgresql" created
        deploymentconfig "gogs-postgresql" created
        service "gogs" created
        route "gogs" created
        deploymentconfig "gogs" created
        imagestream "gogs" created
        persistentvolumeclaim "gogs-data" created
        persistentvolumeclaim "gogs-postgres-data" created
        configmap "gogs-config" created
    --> Success
        Access your application via route 'gogs.apps.lab.example.com'
        Run 'oc status' to view your app.
    
    • 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
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38

    2.5 创建git仓库

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    2.6 git clone

    [root@master ditto]# git clone http://gogs.apps.lab.example.com/salvo/ex280.git
    Cloning into 'ex280'...
    warning: You appear to have cloned an empty repository.
    [root@master ditto]# cd ex280/
    [root@master ex280]# vim README.md
    [root@master ex280]# cat README.md
    faber est quisque fortunae suae
    [root@master ex280]# git add .
    [root@master ex280]# git commit -m 8
    [master (root-commit) 5f37403] 8
     1 file changed, 1 insertion(+)
     create mode 100644 README.md
    [root@master ex280]# git push
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 229 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    Username for 'http://gogs.apps.lab.example.com': salvo
    Password for 'http://salvo@gogs.apps.lab.example.com':redhat
    To http://gogs.apps.lab.example.com/salvo/ex280.git
     * [new branch]      master -> master
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    3. 确认

    刷新git仓库,可以看到README.md已经被提交
    在这里插入图片描述

  • 相关阅读:
    java学习笔记
    Java Web开发环境配置
    vue全局使用sass变量
    Java_题目_学生管理系统_注册登录忘记密码
    Java【抽象类和接口】是什么?
    JAVA医院绩效考核系统源码 功能特点:大型医院绩效考核系统源码
    延误件如何筛选 物流查询分享查询方法筛选延误三天以上物流件
    基于 TLS 1.3的百度安全通信协议 bdtls 介绍
    如何利用无线智能测控终端实现PLC远距离控制推焦车
    【Mysql】mysql学习之旅06-事务
  • 原文地址:https://blog.csdn.net/qq_29974229/article/details/132672356