GKE 工作负载日志未出现在 stackdriver 中

问题描述 投票:0回答:1

我们在容器化的 NodeJS 应用程序上实现了日志记录,在本地 Docker 环境中运行时会捕获所有日志。它们目前托管在 GKE 中。过去 30 天以来,我们无法看到 NodeJS 应用程序生成的任何工作负载日志。

这是集群配置

我们只能看到 GKE 生成的审核日志

[编辑]

kubectl describe pod <workload>

的输出
Name:         anchorservice-c4fbb48b7-fgb4p
Namespace:    default
Priority:     0
Node:         gke-default-pool-e0e18ef3-cjkb/10.128.0.121
Start Time:   Thu, 26 Aug 2021 05:34:18 +0530
Labels:       app=anchorservice
              io.kompose.service=anchorservice
              pod-template-hash=c4fbb48b7
              tier=backend
Annotations:  kubernetes.io/limit-ranger: LimitRanger plugin set: cpu request for container anchorservice
Status:       Running
IP:           10.4.3.9
IPs:
  IP:           10.4.3.9
Controlled By:  ReplicaSet/anchorservice-c4fbb48b7
Containers:
  anchorservice:
    Container ID:   docker://---removed----
    Image:          ---removed----
    Image ID:       docker-pullable://---removed---
    Port:           8081/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Thu, 26 Aug 2021 05:34:34 +0530
    Ready:          True
    Restart Count:  0
    Requests:
      cpu:      100m
    Liveness:   http-get http://:8081/api/healthz delay=3s timeout=1s period=10s #success=1 #failure=3
    Readiness:  http-get http://:8081/api/healthz delay=3s timeout=1s period=10s #success=1 #failure=3
    Environment:
      NODE_ENV:                             production
      PORT:                                 8081
      MONGODB_URL:                          <set to the key 'url' in secret 'mongo-db'>  Optional: false
      REDIS_URL:                            redis://redis-master.default.svc.cluster.local
      VAULT_ENDPOINT:                       http://vault:8200
      VAULT_KEY:                            default (v1:metadata.namespace)
      VAULT_TOKEN:                          <set to the key 'token' in secret 'removed'>  Optional: false
      CONFIG_MONGODB_URL:                   <set to the key 'url' in secret 'removed'>  Optional: false
      ENC_MASTER_KEY:                       <set to the key 'value' in secret 'removed'>   Optional: false
      APP_NAME:                             ANCHORSERVICE
      ELASTICSEARCH_HOST:                   http://elasticsearch-master:9200
      ENCRYPTED_INIT_KEY:                   ---removed----
      
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-n7vd7 (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  default-token-n7vd7:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-n7vd7
    Optional:    false
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason     Age                 From                                                       Message
  ----     ------     ----                ----                                                       -------
  Warning  Unhealthy  12m (x3 over 3h4m)  kubelet, gke-default-pool-e0e18ef3-cjkb  Liveness probe failed: Get http://10.4.3.9:8081/api/healthz: net/http: request canceled (Client.Timeout exceeded while awaiting headers)```
google-cloud-platform google-kubernetes-engine stackdriver google-cloud-stackdriver
1个回答
0
投票

第一点是检查与特定节点上运行的工作负载关联的服务帐户是否已被授予Logs Writer角色。另外,检查日志路由器部分中是否配置了任何日志排除过滤器。

其次,由于节点上的日志吞吐量较高,该节点上的某些日志可能无法导出到 Cloud Logging。 GKE 日志记录代理正式支持每个节点 100 KB/s 的日志记录吞吐量。 当每个节点的日志记录吞吐量超过此阈值(例如,大于 ~200 KB/s)时,日志记录代理可能没有足够的资源来处理所有日志,导致部分日志未导出到 Cloud Logging。

您还可以启用高吞吐量日志记录

© www.soinside.com 2019 - 2024. All rights reserved.