404 Error while creating KongConsumer using kubernetes API with python

I installed Kong ingress in EKS its working. Now i want to create Customer using python with Kubernetes API

Code:-

def main():
config.load_kube_config()
api = client.CustomObjectsApi()

my_resouces = {
    "apiVersion": "configuration.konghq.com/v1",
    "kind": "KongConsumer",
    "metadata": {"name": "testuser", "annotations": {"kubernetes.io/ingress.class": "kong"}},
    "username": "testuser"
}
# Create the resouce
api.create_namespaced_custom_object(
    group="configuration.konghq.com",
    version="v1",
    namespace="default",
    plural="kong",
    body=my_resouces,
)

Error -:

Reason: Not Found
HTTP response headers: HTTPHeaderDict({‘Audit-Id’: ‘663afc53414-ec59-4467-aeeb-13c654baef84’, ‘Cache-Control’: ‘no-cache, private’, ‘Content-Type’: ‘text/plain; charset=utf-8’, ‘X-Content-Type-Options’: ‘nosniff’, ‘Date’: ‘Fri, 12 Mar 2021 14:37:46 GMT’, ‘Content-Length’: ‘19’})
HTTP response body: 404 page not found

Are you able to create KongConsumers using other clients (e.g. kubectl), and are you able to create other resources using the Python client?

The plural for that CRD looks wrong (it should be kongconsumers rather than kong), but other than that we wouldn’t be able to provide much assistance–we aren’t familiar with the Python API server client.

Thankyou For you response.
Much appreciated


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ