首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >kubernetes:当pod处于CrashLoopBackOff状态时,相关事件不会更新?

kubernetes:当pod处于CrashLoopBackOff状态时,相关事件不会更新?
EN

Stack Overflow用户
提问于 2021-07-15 13:18:54
回答 1查看 70关注 0票数 1

我正在测试pod出错时的kubernetes行为。

我现在有一个活体探测失败导致的CrashLoopBackOff状态的pod,从我在kubernetes事件中看到的,pod在3次尝试并开始后退重启后变成了CrashLoopBackOff,但是相关的活体探测失败事件不会更新?

代码语言:javascript
复制
➜  ~ kubectl describe pods/my-nginx-liveness-err-59fb55cf4d-c6p8l
Name:         my-nginx-liveness-err-59fb55cf4d-c6p8l
Namespace:    default
Priority:     0
Node:         minikube/192.168.99.100
Start Time:   Thu, 15 Jul 2021 12:29:16 +0800
Labels:       pod-template-hash=59fb55cf4d
              run=my-nginx-liveness-err
Annotations:  <none>
Status:       Running
IP:           172.17.0.3
IPs:
  IP:           172.17.0.3
Controlled By:  ReplicaSet/my-nginx-liveness-err-59fb55cf4d
Containers:
  my-nginx-liveness-err:
    Container ID:   docker://edc363b76811fdb1ccacdc553d8de77e9d7455bb0d0fb3cff43eafcd12ee8a92
    Image:          nginx
    Image ID:       docker-pullable://nginx@sha256:353c20f74d9b6aee359f30e8e4f69c3d7eaea2f610681c4a95849a2fd7c497f9
    Port:           80/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Thu, 15 Jul 2021 13:01:36 +0800
      Finished:     Thu, 15 Jul 2021 13:02:06 +0800
    Ready:          False
    Restart Count:  15
    Liveness:       http-get http://:8080/ delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-r7mh4 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-r7mh4:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  37m                   default-scheduler  Successfully assigned default/my-nginx-liveness-err-59fb55cf4d-c6p8l to minikube
  Normal   Created    35m (x4 over 37m)     kubelet            Created container my-nginx-liveness-err
  Normal   Started    35m (x4 over 37m)     kubelet            Started container my-nginx-liveness-err
  Normal   Killing    35m (x3 over 36m)     kubelet            Container my-nginx-liveness-err failed liveness probe, will be restarted
  Normal   Pulled     31m (x7 over 37m)     kubelet            Container image "nginx" already present on machine
  Warning  Unhealthy  16m (x32 over 36m)    kubelet            Liveness probe failed: Get "http://172.17.0.3:8080/": dial tcp 172.17.0.3:8080: connect: connection refused
  Warning  BackOff    118s (x134 over 34m)  kubelet            Back-off restarting failed container

BackOff事件在118秒前更新,但不健康事件在16万年前更新?

为什么重启次数只有15次,而BackOff事件有134次?

我使用minikube,我的部署是这样的:

代码语言:javascript
复制
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx-liveness-err
spec:
  selector:
    matchLabels:
      run: my-nginx-liveness-err
  replicas: 1
  template:
    metadata:
      labels:
        run: my-nginx-liveness-err
    spec:
      containers:
      - name: my-nginx-liveness-err
        image: nginx
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        livenessProbe:
          httpGet:
            path: /
            port: 8080
EN

回答 1

Stack Overflow用户

发布于 2021-07-15 16:54:44

我认为您可能混淆了状态条件和事件。事件不会“更新”,它们只是存在。它是来自控制器的事件数据流,用于调试或警报。Age列是该事件类型的最新实例的相对时间戳,您可以查看是否执行了一些基本的重复数据消除。事件也会在几个小时后过期,以防止数据库爆炸。

所以你的问题与活跃度探测器无关,你的容器在启动时会崩溃。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68388319

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档