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

k8s中部署fluentd

复制代码
上传镜像到harbor
创建yaml,包括sa、clusterrole、clusterrolebinding、daemonset
powershell 复制代码
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
相关推荐
雨奔25 分钟前
Kubernetes StatefulSet 详解:有状态服务的部署与管理实战
云原生·容器·kubernetes
成为你的宁宁40 分钟前
【K8s ConfigMap 配置管理创建、挂载与热更新实践】
云原生·容器·kubernetes
徐新帅1 小时前
4181:【GESP2603七级】拆分
c++·学习·算法·信奥赛
敢敢のwings1 小时前
NVIDIA Thor学习之 |在Jetson AGX Thor上部署OpenClaw并基于Ollama的边缘AI协作实战(二)
人工智能·学习
三分钟管理实战案例2 小时前
华恒智信助力传统制造与科技服务行业完成激活组织效能,打破“躺平”困局
学习
y = xⁿ3 小时前
MySQL学习笔记:乐观锁VS悲观锁/八股总结
笔记·学习·mysql
d111111111d3 小时前
STM32-UART抽象层封装
笔记·stm32·单片机·嵌入式硬件·学习
华清远见IT开放实验室3 小时前
嵌入式系统化课程 学习内容与服务说明
linux·stm32·学习·嵌入式·全栈·虚拟仿真·测评中心
爱上好庆祝3 小时前
学习js的第2天
前端·css·学习·html·css3
Dillon Dong3 小时前
【系统运维】Docker版本冲突问题详解:从错误到解决方案
docker·容器