简体   繁体   English

如何将kubernetes事件从GKE集群传播到谷歌云日志

[英]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.

相关问题 Google Cloud Kubernetes - 如何创建区域或区域 GKE 集群? - Google Cloud Kubernetes - How to create Zonal or Regional GKE cluster? Terraform:如何使用命名空间在Google Cloud(GKE)上创建Kubernetes集群? - Terraform: How to create a Kubernetes cluster on Google Cloud (GKE) with namespaces? 如何删除Google Kubernetes集群中的GPU(GKE) - How to remove GPU in Google Kubernetes cluster (GKE) 在 Google Cloud Function 中对 GKE 集群的 Kubernetes API 进行身份验证 - Authentication to Kubernetes API of GKE cluster within Google Cloud Function 如何在 Ansible 中检索已创建的 Google Kubernetes (GKE) 集群的凭据? - How to retrieve credentials of a created Google Kubernetes (GKE) cluster in Ansible? 如何使用自定义图像在 Ansible 中创建 Google Kubernetes (GKE) 集群? - How to create Google Kubernetes (GKE) cluster in Ansible with custom image? 如何使用 python 删除 GKE(Google Kubernetes 引擎)集群? - How to delete GKE (Google Kubernetes Engine) cluster using python? Google的Cloud Run与传统的Kubernetes集群有何不同? - How is Google's Cloud Run different from a traditional Kubernetes cluster? 如何在GKE上扩展Kubernetes集群? - How to scale a Kubernetes cluster on GKE? Google(GKE)中的Kubernetes集群正在扩展节点 - Kubernetes cluster in Google (GKE) is over scaling nodes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM