<p><strong>What happened</strong></p>
<p>I am trying to create custom object in kubernetes using kubernetes python client, but i am unable to do so, it would be helpful if someone can explain what i am doing wrong here</p>
<pre class="lang-sh prettyprint-override"><code>Traceback (most recent call last):
  File &quot;/home/talha/PycharmProjects/doosra/tasks/cluster_tasks.py&quot;, line 585, in &lt;module&gt;
    main()
  File &quot;/home/talha/PycharmProjects/doosra/tasks/cluster_tasks.py&quot;, line 574, in main
    resource = api.get_namespaced_custom_object(
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/api/custom_objects_api.py&quot;, line 1484, in get_namespaced_custom_object
    return self.get_namespaced_custom_object_with_http_info(group, version, namespace, plural, name, **kwargs)  # noqa: E501
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/api/custom_objects_api.py&quot;, line 1591, in get_namespaced_custom_object_with_http_info
    return self.api_client.call_api(
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 348, in call_api
    return self.__call_api(resource_path, method,
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 180, in __call_api
    response_data = self.request(
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/api_client.py&quot;, line 373, in request
    return self.rest_client.GET(url,
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/rest.py&quot;, line 239, in GET
    return self.request(&quot;GET&quot;, url,
  File &quot;/home/talha/PycharmProjects/venv/lib/python3.8/site-packages/kubernetes/client/rest.py&quot;, line 233, in request
    raise ApiException(http_resp=r)
kubernetes.client.exceptions.ApiException: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Cache-Control': 'no-cache, private', 'Content-Type': 'text/plain; charset=utf-8', 'X-Content-Type-Options': 'nosniff', 'Date': 'Mon, 07 Sep 2020 00:41:25 GMT', 'Content-Length': '19'})
HTTP response body: 404 page not found
</code></pre>
<p><strong>What you expected to happen</strong>:
Custom Object found</p>
<p><strong>How to reproduce it (as minimally and precisely as possible)</strong>:</p>
<pre class="lang-py prettyprint-override"><code>    from kubernetes import client
from kubernetes.client import Configuration
from kubernetes.config import kube_config

class K8s(object):
    def __init__(self, configuration_json):
        self.configuration_json = configuration_json
        # self._configuration_json = None

    @property
    def client(self):
        k8_loader = kube_config.KubeConfigLoader(self.configuration_json)
        call_config = type.__call__(Configuration)
        k8_loader.load_and_set(call_config)
        Configuration.set_default(call_config)
        return client

def main():
    cls = {
        &quot;kind&quot;: &quot;Config&quot;,
        &quot;users&quot;: [
            {
                &quot;name&quot;: &quot;xyx&quot;,
                &quot;user&quot;: {
                    &quot;client-key-data&quot;: &quot;daksjdkasjdklj==&quot;,
                    &quot;client-certificate-data&quot;: &quot;skadlkasldk&quot;
                }
            }
        ],
        &quot;clusters&quot;: [
            {
                &quot;name&quot;: &quot;cluster1&quot;,
                &quot;cluster&quot;: {
                    &quot;server&quot;: &quot;https://cyx.cloud.ibm.com&quot;,
                    &quot;certificate-authority-data&quot;: &quot;sldklaksdl=&quot;
                }
            }
        ],
        &quot;contexts&quot;: [
            {
                &quot;name&quot;: &quot;cluster1/admin&quot;,
                &quot;context&quot;: {
                    &quot;user&quot;: &quot;admin&quot;,
                    &quot;cluster&quot;: &quot;cluster1&quot;,
                    &quot;namespace&quot;: &quot;default&quot;
                }
            }
        ],
        &quot;apiVersion&quot;: &quot;v1&quot;,
        &quot;preferences&quot;: {},
        &quot;current-context&quot;: &quot;cluster1/admin&quot;
    }
    
    config_trgt = K8s(configuration_json=cls).client
    api = config_trgt.CustomObjectsApi()
    
    resource = api.get_namespaced_custom_object(
        group=&quot;velero.io&quot;,
        version=&quot;v1&quot;,
        namespace=&quot;velero&quot;,
        plural=&quot;backups&quot;,
        name=&quot;apple&quot;
    )
    print(resource)

if __name__ == &quot;__main__&quot;:
    main()
</code></pre>
<p><strong>Anything else we need to know?</strong>:
I am able to use all other api including create_namespaced_custom_object()
I can view this custom object using &quot;kubectl get backup -n velero&quot;</p>
<p><strong>CRD</strong>
<a href="https://gist.githubusercontent.com/talhalatifkhan/c6eba420e327cf5ef8da1087c326e0a1/raw/d030950775b87a60ecfdb4370fbd518169118d26/gistfile1.txt" rel="nofollow noreferrer">https://gist.githubusercontent.com/talhalatifkhan/c6eba420e327cf5ef8da1087c326e0a1/raw/d030950775b87a60ecfdb4370fbd518169118d26/gistfile1.txt</a></p>
<p><strong>CUSTOM OBJECT</strong></p>
<p><a href="https://gist.githubusercontent.com/talhalatifkhan/0537695a1f08b235cbe87d83a3f83296/raw/030cf503a33a9162251a61380105c719037b90ad/gistfile1.txt" rel="nofollow noreferrer">https://gist.githubusercontent.com/talhalatifkhan/0537695a1f08b235cbe87d83a3f83296/raw/030cf503a33a9162251a61380105c719037b90ad/gistfile1.txt</a></p>
<p><strong>Environment</strong>:</p>
<ul>
<li>Kubernetes version (v1.18.6)</li>
<li>OS (Linux 20.04):</li>
<li>Python version (3.8.2)</li>
<li>Python client version (12.0.0a1)</li>
</ul>

Talha Latif
<p>Used python 3.6 and it no longer returns status.code 404.</p>
