当前位置: 首页 > 知识库问答 >
问题:

kubernetes Pod的readinessProbe出错,但未从服务中删除endpoint

陆弘新
2023-03-14

-https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes

但此Pod的IP仍在服务的endpoint中。为什么?

Clouddriver Pod YAML

kubectl -n spinnaker-test get pods spin-clouddriver-5559d44484-mp8q9 -o yaml

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubernetes.io/psp: spotify.backend-service
  creationTimestamp: 2019-02-15T20:46:38Z
  generateName: spin-clouddriver-5559d44484-
  labels:
    app: spin
    app.kubernetes.io/managed-by: halyard
    app.kubernetes.io/name: clouddriver
    app.kubernetes.io/part-of: spinnaker
    app.kubernetes.io/version: 1.12.1
    cluster: spin-clouddriver
    pod-template-hash: "1115800040"
  name: spin-clouddriver-5559d44484-mp8q9
  namespace: spinnaker-test
  ownerReferences:
  - apiVersion: extensions/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: ReplicaSet
    name: spin-clouddriver-5559d44484
    uid: ce79561c-3161-11e9-acdf-42010a800082
  resourceVersion: "53541277"
  selfLink: /api/v1/namespaces/spinnaker-test/pods/spin-clouddriver-5559d44484-mp8q9
  uid: caa66d7c-3162-11e9-acdf-42010a800082
spec:
  containers:
  - env:
    - name: JAVA_OPTS
      value: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2
    - name: SPRING_PROFILES_ACTIVE
      value: local
    image: gcr.io/spinnaker-marketplace/clouddriver:4.3.1-20190130095322
    imagePullPolicy: IfNotPresent
    lifecycle: {}
    name: clouddriver
    ports:
    - containerPort: 7002
      protocol: TCP
    readinessProbe:
      exec:
        command:
        - wget
        - --no-check-certificate
        - --spider
        - -q
        - http://localhost:7002/health
      failureThreshold: 3
      periodSeconds: 10
      successThreshold: 1
      timeoutSeconds: 1
    resources:
      limits:
        cpu: "20"
        memory: 5000Mi
      requests:
        cpu: "20"
        memory: 5000Mi
    securityContext:
      allowPrivilegeEscalation: false
    terminationMessagePath: /dev/termination-log
    terminationMessagePolicy: File
    volumeMounts:
    - mountPath: /opt/spinnaker/config
      name: spin-clouddriver-files-1952526246
    - mountPath: /home/halyard/.hal/k8s-spinnaker/staging/dependencies
      name: spin-clouddriver-files-1757773194
    - mountPath: /var/run/secrets/kubernetes.io/serviceaccount
      name: default-token-w2lt5
      readOnly: true
  dnsPolicy: ClusterFirst
  nodeName: gke-production-us-ce-terraform-201812-d63606d6-9vq9
  restartPolicy: Always
  schedulerName: default-scheduler
  securityContext: {}
  serviceAccount: default
  serviceAccountName: default
  terminationGracePeriodSeconds: 720
  tolerations:
  - effect: NoExecute
    key: node.kubernetes.io/not-ready
    operator: Exists
    tolerationSeconds: 300
  - effect: NoExecute
    key: node.kubernetes.io/unreachable
    operator: Exists
    tolerationSeconds: 300
  volumes:
  - name: spin-clouddriver-files-1952526246
    secret:
      defaultMode: 420
      secretName: spin-clouddriver-files-1952526246
  - name: spin-clouddriver-files-1757773194
    secret:
      defaultMode: 420
      secretName: spin-clouddriver-files-1757773194
  - name: default-token-w2lt5
    secret:
      defaultMode: 420
      secretName: default-token-w2lt5
status:
  conditions:
  - lastProbeTime: null
    lastTransitionTime: 2019-02-15T20:46:38Z
    status: "True"
    type: Initialized
  - lastProbeTime: null
    lastTransitionTime: 2019-02-15T20:53:40Z
    status: "True"
    type: Ready
  - lastProbeTime: null
    lastTransitionTime: 2019-02-15T20:46:38Z
    status: "True"
    type: PodScheduled
  containerStatuses:
  - containerID: docker://3509b48511b1ea7bc97812cb82831c559d9410cb9eaaa26b4f492d881603fb31
    image: gcr.io/spinnaker-marketplace/clouddriver:4.3.1-20190130095322
    imageID: docker-pullable://gcr.io/spinnaker-marketplace/clouddriver@sha256:466228b97b8c4a61a0270c53ae4c397eb04bc3661bc4f1ee9ef4d5fce70d187d
    lastState: {}
    name: clouddriver
    ready: true
    restartCount: 0
    state:
      running:
        startedAt: 2019-02-15T20:47:26Z
  hostIP: 10.178.32.98
  phase: Running
  podIP: 10.179.34.24
  qosClass: Guaranteed
  startTime: 2019-02-15T20:46:38Z
kubectl -n spinnaker-test describe pods spin-clouddriver-5559d44484-mp8q9

Name:           spin-clouddriver-5559d44484-mp8q9
Namespace:      spinnaker-test
Node:           gke-production-us-ce-terraform-201812-d63606d6-9vq9/10.178.32.98
Start Time:     Fri, 15 Feb 2019 15:46:38 -0500
Labels:         app=spin
                app.kubernetes.io/managed-by=halyard
                app.kubernetes.io/name=clouddriver
                app.kubernetes.io/part-of=spinnaker
                app.kubernetes.io/version=1.12.1
                cluster=spin-clouddriver
                pod-template-hash=1115800040
Annotations:    kubernetes.io/psp=spotify.backend-service
Status:         Running
IP:             10.179.34.24
Controlled By:  ReplicaSet/spin-clouddriver-5559d44484
Containers:
  clouddriver:
    Container ID:   docker://3509b48511b1ea7bc97812cb82831c559d9410cb9eaaa26b4f492d881603fb31
    Image:          gcr.io/spinnaker-marketplace/clouddriver:4.3.1-20190130095322
    Image ID:       docker-pullable://gcr.io/spinnaker-marketplace/clouddriver@sha256:466228b97b8c4a61a0270c53ae4c397eb04bc3661bc4f1ee9ef4d5fce70d187d
    Port:           7002/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Fri, 15 Feb 2019 15:47:26 -0500
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     20
      memory:  5000Mi
    Requests:
      cpu:      20
      memory:   5000Mi
    Readiness:  exec [wget --no-check-certificate --spider -q http://localhost:7002/health] delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:
      JAVA_OPTS:               -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2
      SPRING_PROFILES_ACTIVE:  local
    Mounts:
      /home/halyard/.hal/k8s-spinnaker/staging/dependencies from spin-clouddriver-files-1757773194 (rw)
      /opt/spinnaker/config from spin-clouddriver-files-1952526246 (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-w2lt5 (ro)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  spin-clouddriver-files-1952526246:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  spin-clouddriver-files-1952526246
    Optional:    false
  spin-clouddriver-files-1757773194:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  spin-clouddriver-files-1757773194
    Optional:    false
  default-token-w2lt5:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-w2lt5
    Optional:    false
QoS Class:       Guaranteed
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  3m (x321 over 1d)  kubelet, gke-production-us-ce-terraform-201812-d63606d6-9vq9  Readiness probe errored: rpc error: code = DeadlineExceeded desc = context deadline exceeded
kubectl -n spinnaker-test describe services spin-clouddriver

Name:              spin-clouddriver
Namespace:         spinnaker-test
Labels:            app=spin
                   cluster=spin-clouddriver
Annotations:       kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"spin","cluster":"spin-clouddriver"},"name":"spin-clouddriver","namesp...
Selector:          app=spin,cluster=spin-clouddriver
Type:              ClusterIP
IP:                10.178.65.100
Port:              <unset>  7002/TCP
TargetPort:        7002/TCP
Endpoints:         10.179.34.24:7002
Session Affinity:  None
Events:            <none>

kubectl -n spinnaker-test describe endpoints spin-clouddriver

Name:         spin-clouddriver
Namespace:    spinnaker-test
Labels:       app=spin
              cluster=spin-clouddriver
Annotations:  <none>
Subsets:
  Addresses:          10.179.34.24
  NotReadyAddresses:  <none>
  Ports:
    Name     Port  Protocol
    ----     ----  --------
    <unset>  7002  TCP

Events:  <none>
    null

共有1个答案

巢承安
2023-03-14

kubelet的探测可以在三种状态中的一种结束:

  • 成功
  • 失败(命令返回非0退出代码)
  • 错误(超时前命令未返回,容器中不存在命令等)

下面是记录事件probe errored的代码(在1.10.11中)。请注意err!=nil

 类似资料:
  • 我的Jtable有一个listSelectionListener: 我创建了一个按钮来删除带有事件的Jtable的所有行: 如果我在没有选择任何行的情况下按下按钮,则不会出现错误,但当我选择一行,然后按下按钮时,会出现以下错误: 当表没有ListSseltionListener时,不会发生这种情况。我哪里错了? 提前感谢您的帮助。

  • 问题内容: 我有一些javascript代码,可处理使用框架2.0构建的asp.net Web服务的json输出。现在,我需要支持从框架3.5 Web服务返回的数据。 我的JavaScript代码假定对象列表为返回值,在2.0中可以正常工作。但是,在框架3.5中,该列表包装在“ d”对象中。有什么办法可以删除“ d”包装并仅返回列表? 我宁愿在服务器端修复此问题 问题答案: 您不能将3.5+服务配

  • 我正在尝试从数据库中删除记录,以及从服务器中删除该记录的上载图像。我在控制器中有这个功能。 取消链接(C:\xampp\htdocs\larapro\public\newuploads\ 如果我使用 它显示: 解除关联(C: mpp\htdocs\larapro\Public\ewaddads{1470667358.png}):无效参数 我只是想知道为什么链接中的x和n丢失了。

  • 我是JSP的新手,我正在尝试创建一个web界面,用户可以在该界面中输入他们想要删除的信息,并且该信息将在数据库表中删除。 在这里,他们应该输入和,然后应该删除具有两个指定ID的任何数据。但是,它不是从表中删除的。我有个例外 数组索引越界 下面是我的代码:

  • 我已经启动了jboss,但在访问web服务时出现了以下错误。这种情况有时会发生。会有什么问题?是不是丢了个罐子?如果是,那么有时它怎么可能找不到一些jar文件呢?请求指南。web服务的两个URL是“https://203.77.203.196:8447/GetGPRSMTRBillService/services/GetGPRSCONBillDataSOAPPort”和“https://203.7

  • 当我通过GPS移除一个节点时,当我试图打印二叉树时,会出现堆栈溢出。下面是我的一些代码。我不能理解它将如何工作良好,如果我删除的名称,但不是,如果我删除的坐标,因为我正在使用相同的删除方法。 我得到的确切错误是“Exe:0xC00000FD中0x013214D6处的未处理异常:堆栈溢出(参数:0x00000001,0x00152FFC)”。在按坐标删除后,在打印函数中会出现这种情况,但如果按名称删