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
114 Views Asked by D Cruette At
1
There are 1 best solutions below
Related Questions in KUBERNETES
- How to know a Pod's own IP address from inside a container in the Pod?
- Who will decide the "specified number of pods" for replication controller in kubernetes?
- Access other containers of a pod in Kubernetes
- Kubernetes cluster using Vagrant not working after restart
- kubectl not installed with gcloud SDK
- How do I access the Kubernetes api from within a pod container?
- Exposing several services with Vagrant and Kubernetes on my own server
- Does Kubernetes provision new VMs for pods on my cloud platform?
- Any suggestion for running Aerospike on Kubernetes on CoreOS on GCE?
- Kubernetes - kubectl exec bash - session drop and line width
- Google Container Engine (GKE): "Hello Wordpress" tutorial not working (ERR_CONNECTION_REFUSED)
- Kubernetes Pod Creation Speed
- How can i set max count of pods for replication-controller per node?
- Is there a way to tell kubernetes to update your containers?
- Postgres with Kubernetes and persistentDisk
Related Questions in ENVIRONMENT-VARIABLES
- Best way to pass an environment variable to several config files
- How to expand environment variables in python as bash does?
- How to set environment variables with a forward slash in the key
- What is the meaning of environment variable !::=::\
- iOS launch app with environment variable
- How to set Environment variables permanently in C#
- Blank path in environment variable causing elevated command prompt to not respond
- Rails: ENV variable failure outputs double string
- ActiveMQ: Error while loading shared libraries
- setenv, and getenv documentation
- Trying to set and use environment variables with PHP on Ubuntu 14.04
- SECRET_KEY error with Django using uWSGI
- Import linux environment variable from shell file
- Use Dokku Environment variables in DockerFile
- Changing JS variable with Grunt for different environments
Related Questions in KUBERNETES-CRONJOB
- Cron Jobs in Kubernetes - connect to existing Pod, execute script
- How to automatically remove completed Kubernetes Jobs created by a CronJob?
- Get timestamp of the last successful cronjob completion via kubectl
- How can I run a cronjob on multiple nodes sequentially in kubernetes?
- K8s Pod Anti Affinity for Cronjob Pod Even Scheduling
- Controlling cron job on kubernates
- When do Kubernetes Cronjobs create2 jobs or none at all?
- Is it a good practice to use Kubernetes CronJobs for dynamically creating and managing a large number of scheduled jobs?
- Kubernetes cronjob missed two runs
- AWS EKS: schedule a deployment to scale down and up replicas at specific time using CronJob
- k8s cronjob failures missing pod when image pull back-off
- How to scale down cron-job in Kubernetes
- Create dependency between CRON jobs in Kubernetes docker-compose
- Why job doesn't create a pod Kubernetes (Openshift)
- why cant specify container name when using imperative cmd to create cronjob in k8s?
Related Questions in TERRAFORM-PROVIDER-KUBERNETES
- Terraform Kubernetes provider not found
- Ignore all annotations using terraform kubernetes provider
- Terraform error connection refused: wrongly using localhost
- How to read the kubernetes pod's creation timestamp with Terraform
- Terraform kubernetes provider
- Terraform create a kubernetes resource by using kubectl kustomization
- Create resources using multiple Terraform providers (GCP and Kubernetes) in the same TF script
- Failed to construct REST client
- How to define a service label for a kubernetes service running on GKE
- How to pass array values from the terraform to the Helm chart values.yaml file using terraform-provider?
- How to properly use the access token to authenticate to Docker Hub using Terraform?
- Terraform provider's resources not available in other tf files
- Error: Waiting for rollout to finish: 3 replicas wanted; 0 replicas Ready
- How can I debug custom terraform provider which I have implemented
- How to pass values to a .env file using terraform
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)
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?
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.