python icon indicating copy to clipboard operation
python copied to clipboard

client.CoreV1Api.read_namespaced_pod(pod_name, pod_namespace) returning incomplete data for several minutes after pod is deployed

Open chickling123 opened this issue 1 year ago • 3 comments

client.CoreV1Api.read_namespaced_pod(pod_name, pod_namespace) returns incomplete data for several minutes after pod is deployed if it is queried as soon as pod is deployed.

A bit more detail ... I am deploying a pod and then immediately using the read_namespaced_pod method to determine the pod IP. Here is an outline of the code I am running. pod_ip is set to None for several minutes after the pod is deployed, and well after I can query the pod IP using kubectl describe pod <pod_name> . Presumably the read_namespaced_pod is returning a cached result that contains incomplete data.

pod = read_namespaced_pod(pod_name, pod_namespace) pod_ip = pod.status.pod_ip

I've worked around this for now by inserting a 10s sleep after a pod is deployed before attempting to determine the pod_ip. That appears to be consistently working.

chickling123 avatar Feb 28 '24 15:02 chickling123

Hi, I guess it's due to the pod status is not running, the network is creating and ip for this pod is not ready. When the pod status is running, which means a certain ip has been assigned to the pod, meanwhile it also has been added to the pod status section and stored in etcd. After that you can run your code to get the pod ip.

showjason avatar Feb 29 '24 16:02 showjason

/assign @showjason

roycaihw avatar Mar 13 '24 20:03 roycaihw

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jun 11 '24 20:06 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jul 11 '24 21:07 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Aug 10 '24 21:08 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Aug 10 '24 21:08 k8s-ci-robot