• Flink Operator 使用指南 之 全局配置


    背景

    在上一个章节中已经介绍了基本的Flink-Operator安装,但是在实际的数据中台的项目中,用户可能希望看到Flink Operator的运行日志情况,当然这可以通过修改Flink-Operator POD的文件实现卷挂载的形势将日志输出到宿主机器的指定目录下,但是这种办法对数据中台的产品不是特别友好,因此我们需要将Operator服务的日志输出到Kafka Appender中;因此我们需要修改Flink Operator的helm中的values配置文件文件,达成我们的目标.

    默认情况下Flink Operator不支持Kafka Appender日志输出,为了支持改能力,需要在flink-operator的镜像编译的时候添加kafka依赖,这里小编是在flink-kubernetes-operator模块的pom.xml文件中添加如下配置

    
    <properties>
        <kafka-clients.version>2.2.0kafka-clients.version>
    properties>
    ...
    
    <dependency>
        <groupId>org.apache.kafkagroupId>
        <artifactId>kafka-clientsartifactId>
        <version>${kafka-clients.version}version>
    dependency>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    然后对flink-operator重新进行打包编译,重新发布flink-kubernetes-operator镜像即可

    日志采集

    可以这么理解flink-operator服务是一个flink 任务提交的客户端,在设计的时候会在提交作业的时候允许用户覆盖log4j-console.propertieslog4j-operator.properties配置文件,其中如果用户需要采集k8s作业容器的运行日志可以尝试配置log4j-console.properties配置文件,如果是希望查看flink-operator服务本身的日志需要覆盖log4j-operator.properties配置文件。

    ################################################################################
    #  Licensed to the Apache Software Foundation (ASF) under one
    #  or more contributor license agreements.  See the NOTICE file
    #  distributed with this work for additional information
    #  regarding copyright ownership.  The ASF licenses this file
    #  to you under the Apache License, Version 2.0 (the
    #  "License"); you may not use this file except in compliance
    #  with the License.  You may obtain a copy of the License at
    #
    #      http://www.apache.org/licenses/LICENSE-2.0
    #
    #  Unless required by applicable law or agreed to in writing, software
    #  distributed under the License is distributed on an "AS IS" BASIS,
    #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    #  See the License for the specific language governing permissions and
    # limitations under the License.
    ################################################################################
    
    ---
    
    # List of kubernetes namespaces to watch for FlinkDeployment changes, empty means all namespaces.
    # When enabled RBAC is only created for said namespaces, otherwise it is done for the cluster scope.
    # watchNamespaces: ["flink"]
    
    image:
      repository: ghcr.io/apache/flink-kubernetes-operator
      pullPolicy: IfNotPresent
      tag: "51eeae1"
      # If image digest is set then it takes precedence and the image tag will be ignored
      # digest: ""
    
    imagePullSecrets: []
    
    # Replicas must be 1 unless operator leader election is configured
    replicas: 1
    
    # Strategy type must be Recreate unless leader election is configured
    strategy:
      type: Recreate
    
    rbac:
      create: true
      # kubernetes.rest-service.exposed.type: NodePort requires
      # list permission for nodes at the cluster scope.
      # Set create to true if you are using NodePort type.
      nodesRule:
        create: false
      operatorRole:
        create: true
        name: "flink-operator"
      operatorRoleBinding:
        create: true
        name: "flink-operator-role-binding"
      jobRole
    • 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
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
  • 相关阅读:
    高等数学(第七版)同济大学 习题10-2(中5题) 个人解答
    从0开始启动一个Django的docker服务
    【OFDM系列5】单输入单输出OFDM(SISO-OFDM)多径信道迫零(ZF)和最小均方误差(MMSE)均衡器原理和公式推导
    【Spring】Ioc容器
    Java设计模式之策略模式
    MySQL的三种日志文件
    Python150题day14
    如何使用ChatGPT辅助写论文、数据分析、AI绘图?【附学习资料】
    Spring之环境变量配置
    Redis 常用命令的学习
  • 原文地址:https://blog.csdn.net/weixin_38231448/article/details/134507176