<p>Is it possible to use the python API to create a "custom object" in kubernetes?</p>

<p>Edit:</p>

<p>By custom objects I'm refering to <a href="https://kubernetes.io/docs/user-guide/thirdpartyresources/#creating-custom-objects" rel="nofollow noreferrer">this</a>.</p>

<p>Thank you.</p>

<p><a href="https://github.com/kubernetes-incubator/client-python" rel="nofollow noreferrer">client-python</a> now supports TPRs. This is <a href="https://github.com/kubernetes-incubator/client-python/blob/master/examples/create_thirdparty_resource.md" rel="nofollow noreferrer">the example from the repo</a>:</p>

<pre><code>from __future__ import print_function

from pprint import pprint

import kubernetes
from kubernetes import config
from kubernetes.rest import ApiException

config.load_kube_config()
api_instance = kubernetes.ThirdPartyResources()

namespace = 'default'
resource = 'repos'
fqdn = 'git.k8s.com'

body = {}
body['apiVersion'] = "git.k8s.com/v1"
body['kind'] = "RePo"
body['metadata'] = {}
body['metadata']['name'] = "blog-repo"
body['repo'] = "github.com/user/my-blog"
body['username'] = "username"
body['password'] = "password"
body['branch'] = "branch"



try: 
    # Create a Resource
    api_response = api_instance.apis_fqdn_v1_namespaces_namespace_resource_post(
        namespace, fqdn, resource, body)
    pprint(api_response)
except ApiException as e:
    print(
        "Exception when calling DefaultApi-&gt;apis_fqdn_v1_namespaces_namespace_resource_post: %s\n" % 
        e)
</code></pre>

<p>ref: <a href="https://github.com/kubernetes-incubator/client-python/blob/master/examples/create_thirdparty_resource.md" rel="nofollow noreferrer">https://github.com/kubernetes-incubator/client-python/blob/master/examples/create_thirdparty_resource.md</a></p>
