[英]How to propagate kubernetes events from a GKE cluster to google cloud log
Is there anyway to propagate all kubernetes events to google cloud log? 反正有没有将所有kubernetes事件传播到谷歌云日志?
For instance, a pod creation/deletion or liveness probing failed, I knew I can use kubectl get events in a console. 例如,pod创建/删除或活动探测失败,我知道我可以在控制台中使用kubectl get事件。
However, I would like to preserve those events in a log file in the cloud log with other pod level logs. 但是,我希望将这些事件保存在云日志中的日志文件中,并包含其他pod级日志。
It is quite helpful information. 这是非常有用的信息。
It seems that OP found the logs, but I wasn't able to on GKE (1.4.7) with Stackdriver. 看来OP发现了日志,但我无法使用Stackdriver在GKE(1.4.7)上。 It was a little tricky to figure out, so I thought I'd share for others.
弄清楚这有点棘手,所以我想我会分享给别人。 I was able to get them by creating an eventer deployment with the gcl sink.
通过使用gcl接收器创建一个eventer部署,我能够获得它们。
For example: 例如:
deployment.yaml deployment.yaml
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
labels:
k8s-app: eventer
name: eventer
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
k8s-app: eventer
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
k8s-app: eventer
spec:
containers:
- name: eventer
command:
- /eventer
- --source=kubernetes:''
- --sink=gcl
image: gcr.io/google_containers/heapster:v1.2.0
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
memory: 200Mi
requests:
cpu: 100m
memory: 200Mi
terminationMessagePath: /dev/termination-log
restartPolicy: Always
terminationGracePeriodSeconds: 30
Then, search for logs with an advanced filter (substitute your GCE project name): 然后,使用高级过滤器搜索日志(替换您的GCE项目名称):
resource.type="global"
logName="projects/project-name/logs/kubernetes.io%2Fevents"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.