当前位置: 首页 > news >正文

K8S学习之基础四十七:k8s中部署fluentd

k8s中部署fluentd

上传镜像到harbor
创建yaml,包括sa、clusterrole、clusterrolebinding、daemonset
vi fluentd.yaml 
apiVersion: v1
kind: ServiceAccount
metadata:
  name: fluentd
  namespace: kube-logging
  labels:
    app: fluentd
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: fluentd
  labels:
    app: fluentd
rules:
- apiGroups:
  - ""
  resources:
  - pods
  - namespaces
  verbs:
  - get
  - list
  - watch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: fluentd
roleRef:
  kind: ClusterRole
  name: fluentd
  apiGroup: rbac.authorization.k8s.io
subjects:
- kind: ServiceAccount
  name: fluentd
  namespace: kube-logging
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: fluentd
  namespace: kube-logging
  labels:
    app: fluentd
spec:
  selector:
    matchLabels:
      app: fluentd
  template:
    metadata:
      labels:
        app: fluentd
    spec:
      serviceAccount: fluentd
      serviceAccountName: fluentd
      tolerations:
      - key: node-role.kubernetes.io/control-plane
        effect: NoSchedule
      containers:
      - name: fluentd
        image: 172.16.80.140/fluent/fluentd-kubernetes-daemonset:v1.16-debian-elasticsearch7-1
        imagePullPolicy: IfNotPresent
        env:
          - name: FLUENT_ELASTICSEARCH_HOST
            value: "elasticsearch.kube-logging.svc.cluster.local"
          - name: FLUENT_ELASTICSEARCH_PORT
            value: "9200"
          - name: FLUENT_ELASTICSEARCH_SCHEME
            value: "http"
          - name: FLUENTD_SYSTEMD_CONF
            value: disable
          - name: FLUENT_CONTAINER_TAIL_PARSER_TYPE
            value: "cri"
          - name: FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT
            value: "%Y-%m-%dT%H:%M:%S.%L%z"
        resources:
          limits:
            memory: 512Mi
          requests:
            cpu: 100m
            memory: 200Mi
        volumeMounts:
        - name: varlog
          mountPath: /var/log
        - name: containers
          mountPath: /var/log/containers
          readOnly: true
      terminationGracePeriodSeconds: 30
      volumes:
      - name: varlog
        hostPath:
          path: /var/log
      - name: containers
        hostPath:
          path: /var/log/containers
kubectl apply -f fluentd.yaml
kubectl get pods -n kube-logging -owide

在这里插入图片描述

相关文章:

  • Java多线程与高并发专题——如何利用 CompletableFuture 解决“聚合打车服务平台”的问题?
  • 2.4 隐函数及由参数方程确定的函数求导
  • C#中值类型与引用类型是直观使用示例
  • __init__.py
  • openGauss关联列数据类型不一致引起谓词传递失败
  • fuse性能关键参数entry_timeout
  • python面试高频考点(深度学习大模型方向)
  • V8引擎源码编译踩坑实录
  • 如何在 Vue 项目中使用v - show和v - if指令,它们的原理、区别和适用场景是什么
  • jangow-01-1.0.1靶机攻略
  • QuecPython 外设接口之GPIO应用指南
  • java中的常量可以不用在声明的时候初始化,c中的必须在声明的时候初始化,可不可以这么理解?
  • HDMI(High-Definition Multimedia Interface)详解
  • 三分钟读懂微服务
  • UE4学习笔记 FPS游戏制作16 重构FppShooter和RoboteShooter 提出父类Shooter
  • HTML应用指南:利用POST请求获取城市肯德基门店位置信息
  • 【八股文】http怎么建立连接的
  • 破解云端依赖!如何通过Flowise搭建私有化的端到端AI开发环境
  • [250324] Kafka 4.0.0 版本发布:告别 ZooKeeper,拥抱 KRaft!| Wine 10.4 发布!
  • 上海瀛旻信息科技有限公司
  • 农行一季度净利润719亿元增2.2%,不良率微降至1.28%
  • 匈牙利国会通过退出国际刑事法院的决定
  • 铁路五一假期运输今日启动,预计发送旅客1.44亿人次
  • 澎湃回声|山东莱州、潍坊对“三无”拖拉机产销市场展开调查排查
  • 非法收受财物逾1648万,湖南原副厅级干部康月林一审被判十年半
  • 五一期间上海景观照明开启重大活动模式,外滩不展演光影秀