I build a Kubernetes cronjob scheduled every minute. I need to capture the pod creation timestamp (some pods are created quickly but take time to startup) for a specific functional reason. With Terraform it is possible to set environment variables (job_template / spec / template / container / env / value_from) but the documentation does not mention the pod creation_timestamp inner property. Is there any way to populate a environment variable with this information using Terraform ? Thanks for your help
How to read the kubernetes pod's creation timestamp with Terraform
116 views Asked by D Cruette At
1
There are 1 answers
Related Questions in KUBERNETES
- Golang == Error: OCI runtime create failed: unable to start container process: exec: "./bin": stat ./bin: no such file or directory: unknown
- I can't create a pod in minikube on windows
- Oracle setting up on k8s cluster using helm charts enterprise edition
- Retrieve the Dockerfile configuration from the Kubernetes and also change container Java parameter?
- Summarize pods not running, by Namespace and Reason - I'm having trouble finding the reason
- How to get Java running parameters from Spring Boot running inside container in pod where no ps exist
- How do we configure prometheus server to scrape metrics from a pod with Istio sidecar proxy?
- In rke kube-proxy pod is not present
- problem with edge server registration in Eureka
- Unable to Access Kubernetes LoadBalancer Service from Local Device Outside Cluster
- Kubernetes cluster on GCE connection refused error
- Based on my experience, I've outlined the Kubernetes request flow. Could someone please add or highlight any points I might have overlooked?
- how to define StackGres helm chart "restapi" values to use internal LoadBalancer - AWS EKS
- Python3.11 can't open file [Errno 2] No such file or directory
- Cannot find remote pod service - SERVICE_UNAVAILABLE
Related Questions in ENVIRONMENT-VARIABLES
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Windows environment variables at appsettings.json
- API key 401 error in .env.development file
- Vite TypeError: Cannot read properties of undefined (reading 'VITE_YOUTUBE_API_KEY')
- Set environment variable during push for GitHub Actions
- Is there a way to read .csproj PropertyGroup variable in c#
- My environment variables are not recognized in Azure - ASP.NET Core MVC
- Is it best to declare global variables in a header file or environment file in a C project
- NextJS public environment variables are not recognized in my elastic beanstalk
- Shell script for copying environment variables into config.json?
- Locally testing OS environmental variables in Ballerina
- Is using NEXT_PUBLIC for my secret key is a dangerous way to use environment variables when I deploy on vercel?
- can't add another folder path in environment variables
- How to use ProxyAgent with http_proxy and no_proxy environment variables
- New values not being loaded for .env for SvelteKit app
Related Questions in KUBERNETES-CRONJOB
- Kubernetes: I can't get my cronjob to mount a PersistentVolumeClaim
- How resume suspended cron job having concurrency policy as forbid
- CronJob pod repeats pending forever even after deleting it
- AKS - Cronjob use script file inside PVC
- generate cronschedule for two cronjobs which gets executed alternatively
- Session/EntityManager and (EntityManagerFactory) is closed following update to Spring Batch 5.1.0
- How to run GCP Cron job in privilege mode
- Different resource description from Kubernetes Dashboard and kubectl
- How to read the kubernetes pod's creation timestamp with Terraform
- How to to schedule a Job (not a CronJob) to an future date?
- Cronjob is not executing at scheduled interval
- Why job doesn't create a pod Kubernetes (Openshift)
- why cant specify container name when using imperative cmd to create cronjob in k8s?
- k8s cronjob failures missing pod when image pull back-off
- How to scale down cron-job in Kubernetes
Related Questions in TERRAFORM-PROVIDER-KUBERNETES
- How should a kubernetes service account and token be configured in Terraform to avoid a race condition?
- Accessing output value from a data source in a remote state file
- How to read the kubernetes pod's creation timestamp with Terraform
- Terraform error connection refused: wrongly using localhost
- Ignore all annotations using terraform kubernetes provider
- Terraform Kubernetes Server Version
- Kubernetes cluster unreachable with Terraform and Helm
- Terraform Error: missing resource instance key
- Not able to install 3rd party provider plugins
- Error: Waiting for rollout to finish: 3 replicas wanted; 0 replicas Ready
- How to properly use the access token to authenticate to Docker Hub using Terraform?
- Terraform provider's resources not available in other tf files
- How to pass array values from the terraform to the Helm chart values.yaml file using terraform-provider?
- Resource "kubernetes_service_account" cannot be made depend_on resource "aws_eks_cluster"
- create p12 keystore secret in TF's kubernetes provider
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Kubernetes's mechanism for exposing details of the pod spec to the running process is the downward API, with a specific environment variable path. The Terraform
kubernetes_poddocumentation lists some specific fields thatfield_refandresource_field_refallow, which exactly match the available fields in the downward API.None of these fields are the creation timestamp of the Pod, so this information isn't available via the downward API, and you can't get it in an environment variable. You can generally see the Pod's name, namespace, annotations, labels, IP addresses, and resource requests and limits, but not arbitrary fields from the Pod spec.
For many practical purposes, it may be enough to just capture a time stamp as the first thing the Job's main process does. As you note, there may be a substantial delay between the CronJob triggering, the Pod being created, and the process actually starting (imagine for example the cluster autoscaler needing to provision a new node for the Pod to run on), and I don't believe this delay is visible to the process at all.