Additional Resource Methods

In addition to basic resource management via REST, the API also provides some extremely useful endpoints for certain resources.

For example, you can access the logs of a container, exec into it, and watch changes to it with the following endpoints:

$ curl --cert /tmp/client.pem --key /tmp/client-key.pem\ --cacert /tmp/ca.pem -v -XGET \ https://10.128.0.3:6443/api/v1/namespaces/default/pods/firstpod/log

This would be the same as the following. If the container does not have any standard out, there would be no logs.

$ kubectl logs firstpod

There are other calls you could make, following the various API groups on your cluster:

GET /api/v1/namespaces/{namespace}/pods/{name}/exec

GET /api/v1/namespaces/{namespace}/pods/{name}/log

GET /api/v1/watch/namespaces/{namespace}/pods/{name}

Last updated