阿里云智能log-pilot收集容器日志
apiVersion: apps/v1kind: DaemonSetmetadata:name: log-pilotlabels:app: log-pilot# 设置期望部署的namespacenamespace: kube-systemspec:selector:matchLabels:app: log-pilotupdateStrategy:type: RollingUpdatetemplat
·
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: log-pilot
labels:
app: log-pilot
# 设置期望部署的namespace
namespace: kube-system
spec:
selector:
matchLabels:
app: log-pilot
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app: log-pilot
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
# 是否允许部署到Master节点上
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
containers:
- name: log-pilot
# 版本请参考https://github.com/AliyunContainerService/log-pilot/releases
image: registry.cn-hangzhou.aliyuncs.com/acs/log-pilot:0.9.7-filebeat
resources:
limits:
memory: 500Mi
requests:
cpu: 200m
memory: 200Mi
env:
- name: "NODE_NAME"
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: "LOGGING_OUTPUT"
value: "elasticsearch"
# 请确保集群到ES网络可达
- name: "ELASTICSEARCH_HOSTS"
value: "10.22.8.33:9200"
# 配置ES访问权限
#- name: "ELASTICSEARCH_USER"
# value: "{es_username}"
#- name: "ELASTICSEARCH_PASSWORD"
# value: "{es_password}"
volumeMounts:
- name: sock
mountPath: /var/run/docker.sock
- name: root
mountPath: /host
readOnly: true
- name: varlib
mountPath: /var/lib/filebeat
- name: varlog
mountPath: /var/log/filebeat
- name: localtime
mountPath: /etc/localtime
readOnly: true
livenessProbe:
failureThreshold: 3
exec:
command:
- /pilot/healthz
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 2
securityContext:
capabilities:
add:
- SYS_ADMIN
terminationGracePeriodSeconds: 30
volumes:
- name: sock
hostPath:
path: /var/run/docker.sock
- name: root
hostPath:
path: /
- name: varlib
hostPath:
path: /var/lib/filebeat
type: DirectoryOrCreate
- name: varlog
hostPath:
path: /var/log/filebeat
type: DirectoryOrCreate
- name: localtime
hostPath:
path: /etc/localtime
容器yaml使用
kind: Deployment
metadata:
name: qwyp-h5
namespace: h5
labels:
version: v1
app: qwyp-h5
spec:
replicas: 1
selector:
matchLabels:
version: v1
app: qwyp-h5
template:
metadata:
labels:
version: v1
app: qwyp-h5
spec:
#imagePullSecrets:
#- name: myregistrykey
containers:
- name: qwyp-h5
image: apache:qwyp
ports:
- containerPort: 80
env:
- name: aliyun_logs_catalina
value: "stdout"
- name: aliyun_logs_access
value: "/var/log/nginx/*.log"
volumeMounts:
- name: log
mountPath: /var/log/nginx/
volumes:
- name: log
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: qwyp-h5-v1
namespace: h5
spec:
type: NodePort
selector:
version: v1
app: qwyp-h5
ports:
- port: 80
targetPort: 80
nodePort: 30383
更多推荐
所有评论(0)