I am writing python script for kubernetes using python client.
I want to count or calculate the POD Ready
state time.
In 30 Second pod Ready or similar.
Right now i am planning to use
'status': {
'conditions': [
{
'last_probe_time': None,
'last_transition_time': datetime.datetime(2019,
12,
17,
13,
14,
58,
tzinfo=tzutc()),
'message': None,
'reason': None,
'status': 'True',
'type': 'Initialized'
},
{
'last_probe_time': None,
'last_transition_time': datetime.datetime(2019,
12,
17,
13,
16,
2,
tzinfo=tzutc()),
'message': None,
'reason': None,
'status': 'True',
'type': 'Ready'
},
{
'last_probe_time': None,
'last_transition_time': datetime.datetime(2019,
12,
17,
13,
16,
2,
tzinfo=tzutc()),
'message': None,
'reason': None,
'status': 'True',
'type': 'ContainersReady'
},
{
'last_probe_time': None,
'last_transition_time': datetime.datetime(2019,
12,
17,
13,
14,
58,
tzinfo=tzutc()),
'message': None,
'reason': None,
'status': 'True',
'type': 'PodScheduled'
}
]
But looking forward to directly can get total Ready state time from Pod initialised time.
can anybody suggest better way.
Thanks a lot.
There isn't something specific, you already have the data you need. Just go through the list and find the two last_transition_times for Ready and Initialized and then subtract.