Skip to main content

A tool for observing Kubernetes pods' statuses in real time.

Project description

License: MIT Build Status PyPI version Codacy Badge Slack

ocular

A tool for observing Kubernetes pods' statuses in real time.

Description

Often times it's very hard to translate a Kubernetes event to a concrete state, and that's the gap that ocular tries fill, i.e. return one of the following statuses:

created
building
unschedulable
scheduled
running
succeeded
failed
stopped
unknown

ocular returns as well a condensed information about the reason of that status.

Install

$ pip install -U ocular

Usage

import ocular
from kubernetes import client

api_client = client.api_client.ApiClient(configuration=...)

for pod_state in ocular.monitor(api_client, 
                                namespace='polyaxon', 
                                container_names=('polyaxon-experiment-job',), 
                                label_selector='app in (workers,dashboard),type=runner'):
    print(pod_state)

Results

...
>> {'status': 'unknown', 'message': 'Unknown pod conditions', 'details': {'event_type': 'ADDED', 'labels': ...
>> {'status': 'building', 'message': None, 'details': {'event_type': 'MODIFIED', 'labels': ...
>> {'status': 'building', 'message': 'PodInitializing', 'details': {'event_type': 'MODIFIED', 'labels': ...
>> {'status': 'building', 'message': 'PodInitializing', 'details': {'event_type': 'MODIFIED', 'labels': ...
>> {'status': 'running', 'message': None, 'details': {'event_type': 'MODIFIED', 'labels': ...
>> {'status': 'running', 'message': None, 'details': {'event_type': 'MODIFIED', 'labels': ...
>> {'status': 'succeeded', 'message': None, 'details': {'event_type': 'MODIFIED', 'labels': ...
...

License

FOSSA Status

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocular-0.1.7.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

ocular-0.1.7-py2.py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page