• k8s 日志的收集


    filebeat的ConfigMap的文件

    [root@laso yaml]# cat configmap.yaml 
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: filebeat-config
    data:
      filebeat.yml: |
        filebeat.prospectors:
        - input_type: log
          paths:
            - "/log/*"
          fields:
            type: "filebeta"
        output.logstash:
          hosts: ["192.168.199.224:5044"]

    java项目的pod

    [root@laso yaml]# cat deployment_consumer.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: consumer
      namespace: default
    spec:
      replicas: 1
      selector:  
        matchLabels:
          app: consumer
          release: beta
      template: 
        metadata:
          labels:
            app: consumer
            release: beta
        spec:
          #nodeSelector:
          #  env: beta
          terminationGracePeriodSeconds: 40
          containers: # pod
          - name: filebeta
            image: registry.cn-beijing.aliyuncs.com/cn_genebox/filebeat:v7
            volumeMounts:
            - name: app-logs
              mountPath: /log
            - name: filebeat-config
              mountPath: /etc/filebeat/
          - name: consumer
            image: registry.cn-beijing.aliyuncs.com/cn_genebox/consumer:v1.0.4
            imagePullPolicy: Always
            ports: 
            - name: port
              containerPort: 8022
            readinessProbe:
              httpGet:
                port: port  #也可以使用80
                path: /smoketest
              initialDelaySeconds: 3 #容器启动后等待1秒开始探测
              periodSeconds: 2 #每隔3秒探测一次       
            livenessProbe:
              httpGet:
                port: port  #也可以使用80
                path: /smoketest
              initialDelaySeconds: 10 #容器启动后等待10秒开始探测
              periodSeconds: 2 #每隔3秒探测一次
            volumeMounts:
             - name: app-logs
               mountPath: /tmp/laso/logs/consumer
          # 拉取容器的账户密码
          imagePullSecrets:
          - name: registry-secret
          # 挂载卷
          volumes:
          - name: app-logs
            hostPath:
             path: /log/consumer   # node主机的/log/consumer挂载在 pod的/tmp/laso/logs/consumer上
             type: DirectoryOrCreate # 目录不存在创建
          # -  name: app-logs
          #   nfs:
          #     path: /home/nfs
          #     server: 192.168.199.226
           #   #type: DirectoryOrCreate
          - name: filebeat-config
            configMap:
              name: filebeat-config
  • 相关阅读:
    Loadrunner:场景运行较长时间后报错:Message id [-17999] was not saved
    JMeter学习(三十二)属性和变量
    LoadRunner参数化MySQL
    Linux下安装使用NMON监控、分析系统性能
    使用Loadrunner进行http接口压力测试
    Windows远程桌面连接Ubuntu 14.04
    oracle转Mysql中,varchar2(10)和number应该转换为什么类型?
    centos下pip安装mysql_python
    JMeter中返回Json数据的处理方法
    如何使用AutoIT完成单机测试
  • 原文地址:https://www.cnblogs.com/lulin9501/p/13230301.html
Copyright © 2020-2023  润新知