-
Notifications
You must be signed in to change notification settings - Fork 183
Support for retrieving logs for pods #36
Comments
I am excited to see this feature. The best place to start is to scope out the API call(s) needed to accomplish this. If I were implementing this, I would start with dissecting what |
Thanks @brosner. According to http://kubernetes.io/docs/api-reference/v1/operations/ this implies making a GET request to
plus some query parameters for the GET. I presume that this should be a method on the Pod object, right, something like def get_logs(self, container=None):
url_base = some_pykube_method_that_does_this()
query_params = { 'pretty': True, ... other query_params}
if container is not None:
query_params['container'] = container
return self.api.get( url_base +
'/api/v1/namespaces/' + self.namespace() + '/pods/' + + '/log', query_params ) this leads me to the following questions:
|
Have made a pull request to solve this issue. Usage is as follows: pykube_api = HTTPClient(KubeConfig.from_file("/path/to/your/.kube/config_kubecluster"))
pre_pod = Pod.objects(pykube_api).filter(selector="app=yourApp")
# line above can be changed by any query that returns a Pod
pod_obj = Pod(pykube_api, pre_pod.response['items'][0])
log_txt = pod_obj.logs() |
Has there been any progress on this since ? Or is unmerged #38 above still the latest progress? |
The PR is the latest progress. I hope to spend a few hour session on pykube this week to get many of the PRs wrapped up and merged in. |
This is now fixed, and awaiting to be merged on #38 ! |
Thanks @pcm32 👍 Looking forward to this feature as well. Can anyone help to review and merge this? |
This feature will be in 0.14.0. |
What would be needed to support log retrieval from pods like you do with
kubectl logs mypod
I'm happy to start coding something with some directions.
The text was updated successfully, but these errors were encountered: