码迷,mamicode.com
首页 > 其他好文 > 详细

K8S 日志收集(二):生产日志

时间:2018-04-28 14:28:56      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:volume   pull   uri   ima   mem   rmi   日志收集   conf   name   

修改docker启动的log参数

修改文件/etc/sysconfig/docker

--log-driver=json-file

创建一个deployment

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: busybox-log-dm
spec:
  replicas: 3
  strategy:
    rollingUpdate:
      maxSurge: 2
      maxUnavailable: 1
    type: RollingUpdate
  selector:
    matchLables:
      name: busybox-log-dm
  template:
    metadata:
      labels:
        name: busybox-log-dm
    spec:
      terminationGracePeriodSeconds: 30
      containers:
      - name: busybox-log
        image: 192.168.19.111/baseimages/busybox:latest
        imagePullPolicy: Always
        args:
        - /bin/sh
        - -c
        - >
          while true:
          do
            sleep 2;
            date -R;
            hostname;
          done
        volumeMounts:
        - name: tz-config
          mountPath: /etc/localtime
      volumes:
        - name: tz-config
          hostPath:
          path: /usr/share/zoneinfo/Asia/Shanghai
              

https://docs.docker.com/config/containers/logging/configure/

K8S 日志收集(二):生产日志

标签:volume   pull   uri   ima   mem   rmi   日志收集   conf   name   

原文地址:https://www.cnblogs.com/panjunbai/p/8966466.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!