<p>I am writing python script for kubernetes using python client.</p>

<p>I want to count or calculate the POD <code>Ready</code> state time.</p>

<p>In 30 Second pod Ready or similar.</p>

<p>Right now i am planning to use</p>

<pre><code>'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'
      }
    ]
</code></pre>

<p>But looking forward to directly can get total Ready state time from Pod initialised time. </p>

<p>can anybody suggest better way.</p>

<p>Thanks a lot.</p>

chagan
<p>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.</p>
