<p>I am trying to hit my custom resource definition endpoint in Kubernetes but cannot find an exact example for how Kubernetes exposes my custom resource definition in the Kubernetes API. If I hit the custom services API with this:</p>

<pre><code>https://localhost:6443/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions
</code></pre>

<p>I get back this response</p>

<pre><code>"items": [
    {
        "metadata": {
            "name": "accounts.stable.ibm.com",
            "selfLink": "/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/accounts.stable.ibm.com",
            "uid": "eda9d695-d3d4-11e9-900f-025000000001",
            "resourceVersion": "167252",
            "generation": 1,
            "creationTimestamp": "2019-09-10T14:11:48Z",
            "deletionTimestamp": "2019-09-12T22:26:20Z",
            "finalizers": [
                "customresourcecleanup.apiextensions.k8s.io"
            ]
        },
        "spec": {
            "group": "stable.ibm.com",
            "version": "v1",
            "names": {
                "plural": "accounts",
                "singular": "account",
                "shortNames": [
                    "acc"
                ],
                "kind": "Account",
                "listKind": "AccountList"
            },
            "scope": "Namespaced",
            "versions": [
                {
                    "name": "v1",
                    "served": true,
                    "storage": true
                }
            ],
            "conversion": {
                "strategy": "None"
            }
        },
        "status": {
            "conditions": [
                {
                    "type": "NamesAccepted",
                    "status": "True",
                    "lastTransitionTime": "2019-09-10T14:11:48Z",
                    "reason": "NoConflicts",
                    "message": "no conflicts found"
                },
                {
                    "type": "Established",
                    "status": "True",
                    "lastTransitionTime": null,
                    "reason": "InitialNamesAccepted",
                    "message": "the initial names have been accepted"
                },
                {
                    "type": "Terminating",
                    "status": "True",
                    "lastTransitionTime": "2019-09-12T22:26:20Z",
                    "reason": "InstanceDeletionCheck",
                    "message": "could not confirm zero CustomResources remaining: timed out waiting for the condition"
                }
            ],
            "acceptedNames": {
                "plural": "accounts",
                "singular": "account",
                "shortNames": [
                    "acc"
                ],
                "kind": "Account",
                "listKind": "AccountList"
            },
            "storedVersions": [
                "v1"
            ]
        }
    }
]
}
</code></pre>

<p>This leads me to believe I have correctly created the custom resource <em><strong>accounts</strong></em>. There are a number of examples that don't seem to be quite right and I cannot find my resource in the Kubernetes REST api. I can use with my custom resource from <strong>kubectl</strong> but I need to expose it with RESTful APIs.</p>

<pre><code>https://localhost:6443/apis/stable.example.com/v1/namespaces/default/accounts
</code></pre>

<p>returns</p>

<pre><code>404 page not found
</code></pre>

<p>Where as:</p>

<pre><code>https://localhost:6443/apis/apiextensions.k8s.io/v1beta1/apis/stable.ibm.com/namespaces/default/accounts
</code></pre>

<p>returns</p>

<pre><code>{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the server could not find the requested resource",
"reason": "NotFound",
"details": {},
"code": 404
}
</code></pre>

<p>I have looked at <a href="https://docs.okd.io/latest/admin_guide/custom_resource_definitions.html" rel="nofollow noreferrer">https://docs.okd.io/latest/admin_guide/custom_resource_definitions.html</a> and <a href="https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/</a></p>

<p>The exact URL would be appreciated.</p>

musterjunk
<p>This is a quite decent way retrieving K8s <a href="https://kubernetes.io/docs/reference/using-api/api-overview/" rel="nofollow noreferrer">REST API</a> resource executing <code>kubectl get</code> command on some top debugging levels, like @Suresh Vishnoi mentioned in the comment:</p>

<p><code>kubectl get &lt;api-resource&gt; -v=8</code></p>

<p>Apparently, eventually checked by @Amit Kumar Gupta, the correct URL accessing custom resource as per your CRD json output is the following:</p>

<p><code>https://&lt;API_server&gt;:port/apis/stable.ibm.com/v1/namespaces/default/accounts</code></p>

<p>Depending on the authentication method you may choose: <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#x509-client-certs" rel="nofollow noreferrer">X509 Client Certs</a>, <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#static-token-file" rel="nofollow noreferrer">Static Token File</a>, <a href="https://kubernetes.io/docs/reference/access-authn-authz/authentication/#bootstrap-tokens" rel="nofollow noreferrer">Bearer Token</a> or <a href="https://kubernetes.io/docs/tasks/access-kubernetes-api/http-proxy-access-api/" rel="nofollow noreferrer">HTTP API proxy</a> in order to authenticate user requests against Kubernetes API.</p>
