ConfigMap 생성

1. 01.configmap/configmap.sh

bxcm-install-gen.sh Shell에 의해 생성되어진 설치 yaml 파일의 변경 사항이 없는 경우에는 configmap.sh 을 이용하여 한번에 생성할 수 있다.

다음은 configmap.sh Shell을 실행한 예이다.

            01.configmap$ sh configmap.sh
            ####################################################################################
            # [configmap] start
            ####################################################################################

            >> kubectl apply -f bxframework-batch-configmap.yaml
            configmap/bxframework-batch created
            >> kubectl apply -f bxframework-configmap.yaml
            configmap/bxframework created
            >> kubectl apply -f job-execution-configmap.yaml
            configmap/job-execution-template created
            >> kubectl apply -f webadmin-configmap.yaml
            configmap/bxframework-webadmin created

            ####################################################################################
            # [configmap] end
            ####################################################################################

2. ConfigMap 개별 생성

ConfigMap에 정의되어 있는 프레임워크 설정을 프로젝트에서 구축되는 환경에 따라 추가, 변경 등이 있을 수 있다. 이럴 경우에는 ConfigMap 생성 yaml 파일을 프로젝트 환경에 맞에 수정한 후 kubectl Command를 이용하여 적용하면 된다.

  1. 다음은 각 ConfigMap에 대한 자세한 내용과 적용 방법에 대해서 기술하였다.

    • Online Runtime ConfigMap(bxframework-configmap.yaml) 생성

                              ######################################################
                              # BX Framework Runtime
                              ######################################################
                              apiVersion: v1
                              kind: ConfigMap
                              metadata:
                                name: bxframework
                                namespace: bxcm300
                              data:
                                bxframework.yml: |-
                                  spring:
                                    main:
                                      banner-mode: "off"
                                    cloud:
                                      kubernetes:
                                        discovery:
                                          all-namespaces: true
                                        reload:
                                          enabled: true
                                    zipkin:
                                      enabled: false
      
                                  server:
                                    max-http-header-size: 16KB
                                    error:
                                      include-exception: true
                                      include-stacktrace: on_param
      
                                  bxframework:
                                    request:
                                      system-header: "bxmc.core.ext.context.DefaultSystemHeader"
                                      control-skip-patterns:
                                        - "/error"
                                        - "/v2/api-docs"
                                        - "/actuator/*"
                                      interceptors:  # @Component annotated beanName
                                        - defaultDatabaseServiceControlHandler
                                        - defaultSystemProcessHandler
                                      imageloggers:  # @Component annotated beanName
                                        - defaultDatabaseImageLoggingHandler
                                      logAppenders:
                                        - name: defaultAsyncTableAppender
                                      min-timeout-duration: 30s
                                    message:
                                      sys-message-source: bxmc.core.ext.message.DefaultSystemDatabaseMessageSource
                                      app-message-source: bxmc.core.ext.message.DefaultAppDatabaseMessageSource
                                    datasource:
                                      driver-class-name: com.mysql.cj.jdbc.Driver
                                      jdbc-url: jdbc:mysql://cloud.mshome.net:3306/bxcm300?autoReconnect=true&useUnicode=true&characterEncoding=utf8
                                      username: {username}
                                      password: {password}
                                    application: # BxmApplication
                                      type: online
      
                                  logging:
                                    level:
                                      bxmc: debug
                                      org.apache: error
                                      org.springframework: info

      Kubernetes 적용 방법

      kubectl apply -f bxframework-configmap.yaml
    • Batch Runtime ConfigMap(bxframework-batch-configmap.yaml) 생성

                              ######################################################
                              # BX Framework Bach Runtime
                              ######################################################
                              apiVersion: v1
                              kind: ConfigMap
                              metadata:
                                name: bxframework-batch
                                namespace: bxcm300
                              data:
                                bxframework-batch.yml: |-
                                  spring:
                                    main:
                                      banner-mode: "off"
                                    cloud:
                                      kubernetes:
                                        discovery:
                                          all-namespaces: true
                                        reload:
                                          enabled: true
                                    zipkin:
                                      enabled: false
      
                                  server:
                                    max-http-header-size: 16KB
                                    error:
                                      include-exception: true
                                      include-stacktrace: on_param
      
                                  bxframework:
                                    request:
                                      system-header: "bxmc.core.ext.context.DefaultSystemHeader"
                                    message:
                                      sys-message-source: bxmc.core.ext.message.DefaultSystemDatabaseMessageSource
                                      app-message-source: bxmc.core.ext.message.DefaultAppDatabaseMessageSource
                                    datasource:
                                      driver-class-name: com.mysql.cj.jdbc.Driver
                                      jdbc-url: jdbc:mysql://cloud.mshome.net:3306/bxcm300?autoReconnect=true&useUnicode=true&characterEncoding=utf8
                                      username: {username}
                                      password: {password}
                                    application: # BxmApplication
                                      type: batch
                                    batch:
                                      default-commit-interval: 100
                                      controller: defaultDatabaseBatchControlHandler
                                      preprocessor: defaultBatchPreProcessrHandler
                                      postprocessor: defaultBatchPostProcessorHandler
                                      job-execution-listeners:
                                        - defaultJobExecutionListener
                                      step-execution-listeners:
                                        - defaultStepExecutionListener
                                  job-execution-ext : bxmc.batch.core.repository.dao.BxmJdbcJobExecutionExtDao
                                  step-execution-ext : bxmc.batch.core.repository.dao.BxmJdbcStepExecutionExtDao
      
                                  logging:
                                    level:
                                      bxmc: debug
                                      org.apache: info
                                      org.springframework: info

      Kubernetes 적용 방법

      kubectl apply -f bxframework-batch-configmap.yaml
    • Web Admin ConfigMap(webadmin-configmap.yaml) 생성

                              ######################################################
                              # BXCM Web Admin
                              ######################################################
                              apiVersion: v1
                              kind: ConfigMap
                              metadata:
                                name: bxframework-webadmin
                                namespace: bxcm300
                              data:
                                bxframework-webadmin.yml: |-
                                  spring:
                                    main:
                                      banner-mode: "off"
                                    cloud:
                                      kubernetes:
                                        discovery:
                                          all-namespaces: true
                                        reload:
                                          enabled: true
                                    zipkin:
                                      enabled: false
      
                                  server:
                                    max-http-header-size: 16KB
                                    error:
                                      include-exception: true
                                      include-stacktrace: on_param
      
                                  bxframework:
                                    etcd:
                                      enabled: false
                                    request:
                                      system-header: "bxmc.request.SimpleSystemHeader"
                                      control-skip-patterns:
                                        - "/**"
                                      interceptors:  # @Component annotated beanName
                                        - simpleServiceControlHandler
                                      imageloggers:  # @Component annotated beanName
                                        - simpleImageLoggingHandler
                                      min-timeout-duration: 10s
                                    root-base-pacakge: "bxmc"
                                    base-package: "bxmc.webadmin"
                                    application: # BxmApplication
                                      type: online
                                      datasource: # BxmApplicationDataSourceConfig
                                        main-ds: # DataSource Name <Map, ApplicationDataSource>
                                          jdbc: # JdbcApplicationDataSource
                                            driver-class-name: com.mysql.cj.jdbc.Driver
                                            jdbc-url: jdbc:mysql://cloud.mshome.net:3306/bxcm300?autoReconnect=true&useUnicode=true&characterEncoding=utf8
                                            username: {username}
                                            password: {password}
                                    web-admin:
                                      event-handler: defaultEventHandlerImpl
      
                                  logging:
                                    level:
                                      bxmc: debug
                                      org.apache: info
                                      org.springframework: info
                                      org.springframework.cloud.kubernetes: debug

      Kubernetes 적용 방법

      kubectl apply -f webadmin-configmap.yaml
    • 배치 Job 실행 Template ConfigMap(job-execution-configmap.yaml) 생성

                              ######################################################
                              # BX Framework Job Execution Template
                              ######################################################
                              apiVersion: v1
                              kind: ConfigMap
                              metadata:
                                name: job-execution-template
                                namespace: bxcm300
                              data:
                                job-execution-template.yml: |-
                                  kind: Job
                                  apiVersion: batch/v1
                                  metadata:
                                    name:
                                    labels:
                                      bxcm-batch: bxcm-batch
                                  spec:
                                    template:
                                      spec:
                                        containers:
                                        - name:
                                          image:
                                          imagePullPolicy: IfNotPresent
                                          command: ["java", "-jar", "app.jar"]
                                          #volumeMounts:
                                          #- name: bxframework-batch-file
                                          #  mountPath: /bxframework-batch-file
                                          #- name: BATCH_LOG_PATH
                                          #  value: "/bxframework-batch-file"
                                        restartPolicy: Never
                                        volumes:
                                        #- name: bxframework-batch-file
                                        #  persistentVolumeClaim:
                                        #    claimName: bxframework-batch-pvc
                                    backoffLimit: 0

      Kubernetes 적용 방법

      kubectl apply -f job-execution-configmap.yaml

      참고로 배치에서 배치 파일 공유 및 로그파일을 보기 위해서는 배치 로그 용 공유 볼륨(예 : PVC)이 생성이 되어져 있어야 한다.

ConfigMap 생성을 완료하였다면, 아래 Command를 통하여 확인 할 수 있다.

        01.configmap$ kubectl get configmap
        NAME                           DATA   AGE
        bxframework                    1      10m
        bxframework-batch              1      10m
        bxframework-webadmin           1      10m
        job-execution-template         1      10m
SWLab Bankware Global
  • 전체
  • BXM
  • BXCM
  • BXCP
  • BXI
제품 선택 시 더 정확한 매뉴얼 가이드를 제공해드립니다.

Copyright© Bankwareglobal All Rights Reserved.