Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose pod start time via the Downward API #36813

Closed
0xmichalis opened this issue Nov 15, 2016 · 11 comments
Closed

Expose pod start time via the Downward API #36813

0xmichalis opened this issue Nov 15, 2016 · 11 comments
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/apps Categorizes an issue or PR as relevant to SIG Apps.

Comments

@0xmichalis
Copy link
Contributor

0xmichalis commented Nov 15, 2016

Use-case: a Job or Pod that needs to set timeouts in various points in its lifecycle. For example, a deployer pod that has a global timeout to finish its work and various steps need to use a timeout too.

Deployer pod with a timeout of 10 minutes:

  1. Scales down old replica sets for a deployment
  2. Waits for all pods to be terminated
  3. Executes something
  4. Scales up new replica set

The wait part in the second step needs a timeout of (10m - (time.Now - podStartTime)). The only way to achieve this currently is to use a pod client in the pod and query the api server.

cc: @mfojtik @pmorie

@mfojtik
Copy link
Contributor

mfojtik commented Nov 15, 2016

I'm not sure about implementation as the creationTime is set in status after the Pod is created, which means having an env var that points to that field will always result to that env var being empty (because the vars are set before pod is created).

@0xmichalis
Copy link
Contributor Author

0xmichalis commented Nov 15, 2016

@mfojtik the creation time is metadata but I also think the pod IP is accessible via the downward API, isn't that also status?

@liggitt
Copy link
Member

liggitt commented Nov 16, 2016

also, creationTime != scheduled time != started time... I don't think I'd want processes in a pod timing anything from when the pod was created

@0xmichalis
Copy link
Contributor Author

Right, we want the start time. But the status is still accessible via the downward api.

@0xmichalis 0xmichalis changed the title Expose pod creation time via the Downward API Expose pod start time via the Downward API Nov 16, 2016
@bgrant0607
Copy link
Member

cc @erictune @pmorie

@smarterclayton
Copy link
Contributor

I think this is very reasonable to support.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 31, 2017
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 30, 2018
@0xmichalis
Copy link
Contributor Author

Or exec uptime -s

/close

@leourbina
Copy link

@Kargakis will uptime return the actual uptime of the pod? What if the pod has been restarted (say, due to an intermittent failure)? I'd be nice to know the actual time the pod was started, which if I understand this correctly may not line up with uptime -s.

Any chance that this could be reconsidered as something to add into the API?

@pcn
Copy link

pcn commented Jun 7, 2024

Or exec uptime -s

Uptime seems to reflect the hosts' uptime, and not that of the pod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. sig/apps Categorizes an issue or PR as relevant to SIG Apps.
Projects
None yet
Development

No branches or pull requests

10 participants