K8S 日志收集:生产日志
Posted 不忘初心-铃
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了K8S 日志收集:生产日志相关的知识,希望对你有一定的参考价值。
修改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 日志收集:生产日志的主要内容,如果未能解决你的问题,请参考以下文章