Submit jobs using API Client Library for Python?

2019-09-02 06:35发布

Does API Client Library for Python support creation and deletion of pods and jobs on google container engine?

2条回答
We Are One
2楼-- · 2019-09-02 07:16

Given that Kubernetes comes with a Swagger spec (1.2, not the latest version), you can use swagger-codegen to generate an Python API client for it.

Here is an example to generate Python API client using https://generator.swagger.io:

curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1.json"}' https://generator.swagger.io/api/gen/clients/python

which returns a JSON with an URL to download the zipped Python API client.

Ref: https://github.com/swagger-api/swagger-codegen#online-generators

If you need help with swagger codegen or the Python API client, please open a ticket via https://github.com/swagger-api/swagger-codegen/issues

查看更多
ゆ 、 Hurt°
3楼-- · 2019-09-02 07:18

No. The client library for python contains functions for interacting with the Google Container Engine API but not the Kubernetes API. The Kubernetes API uses a standard swagger specification, so it should be possible to generate a python client library. There is also pykube if you want to experiment with a existing client library.

查看更多
登录 后发表回答