Comments (8)
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 kubectl logs
does and translate it to API calls that can be made by pykube.
from pykube.
Thanks @brosner. According to http://kubernetes.io/docs/api-reference/v1/operations/ this implies making a GET request to
/api/v1/namespaces/{namespace}/pods/{name}/log
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:
- from where in pykube API do I get the base URL for the call?
- am I correct in passing the GET query parameters as kwargs?
from pykube.
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()
from pykube.
Has there been any progress on this since ? Or is unmerged #38 above still the latest progress?
from pykube.
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.
from pykube.
This is now fixed, and awaiting to be merged on #38 !
from pykube.
Thanks @pcm32 👍
Looking forward to this feature as well. Can anyone help to review and merge this?
from pykube.
This feature will be in 0.14.0.
from pykube.
Related Issues (20)
- Add new watch event types
- Delete ReplicationController does not support the Windows platform
- can't support windows platform?
- requests.exceptions.SSLError: hostname HOT 1
- Add example for getting attribute of object HOT 1
- relative paths in kube config file are not interpreted correctly HOT 5
- version api fails when called
- pykube generating tons of files in tmp
- Can we get a list of namespaces in a K8s cluster? HOT 2
- ObjectManager, providing resource.objects(), is not thread-safe
- Add KubeConfig.from_env_var or similar
- Kubernetes OIDC auth not working HOT 1
- support 'kubectl drain' HOT 1
- HTTPError: Job in version "v1" cannot be handled as a Job: [pos 264]: json: expect char '"' but got char '{' HOT 1
- certificate verify failed when REQUESTS_CA_BUNDLE environment variable is set HOT 1
- WatchQuery does not respect the `base` of an object
- Run command
- question about the crd
- Is pyKube still maintained? HOT 3
- Endpoint class has incorrect Kind.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pykube.