Skip to content

how to get namespaces ingressroutes through  #1388

Closed

Description

@andy-kwo-any

Link to the issue (please include a link to the specific documentation or example):

I have the following command line below. It gives me the namespaces and ingressroutes names (see the Example below)

kubectl --context mlf-eks-dev get --all-namespaces ingressroutes

Example

NAMESPACE                       NAME                                                           AGE
aberdeentotalyes               aberdeentotalgeyes-yesgepi                                      98d

Description of the issue (please include outputs or screenshots if possible):
I'm trying to replicate the results above with the python library client for Kubernetes.

I"m trying to replicate the kubetl command line above through my python code, using the python client for kubernetes but I miss on the option, on how to get the ingressroutes.

#My python code
from kubernetes import client, config

# Configs can be set in Configuration class directly or using helper utility
config.load_kube_config()

v1 = client.CoreV1Api()
print("Listing pods with their IPs:")
ret = v1.list_pod_for_all_namespaces(watch=False)
for i in ret.items:
    print("%s\t%s" % (i.metadata.namespace, i.metadata.name))

The results are below

wwwpaulolo   ci-job-backup-2kt6f
wwwpaulolo   wwwpaulolo-maowordpress-7dddccf44b-ftpbq
wwwvhugo        ci-job-backup-dz5hs
wwwvhugo        wwwvhua-maowordpress-5f7bdfdccd-v7kcx

I have the namespaces but not the ingressroutes, as I don't know how can I get it.

Question is what is the option to have the ingressroutes, please?

Any helps are more than welcomed.

Cheers

Activity

  1. tomplus commented on Mar 5, 2021

    @tomplus
    Member

    I guess the context which you pass to kubectl may be important. Could you try to run: kubectl get --all-namespaces ingressroutes?

  2. andy-kwo-any commented on Mar 8, 2021

    @andy-kwo-any
    Author

    Hi @tomplus,

    Thank you. The command you gave me, seems to be my initial command line without the context.

    Best regards,
    Andy

  3. roycaihw commented on Mar 15, 2021

    @roycaihw
    Member

    /assign

  4. roycaihw commented on Mar 15, 2021

    @roycaihw
    Member

    It looks like you were using the list_pod_for_all_namespaces function and you want a list_ingressroute_for_all_namespaces function. ingressroute is a CRD so it doesn't have a dedicated function for it. You can use the dynamic custom_object functions and pass in the group, version, plural of ingressroute: https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/CustomObjectsApi.md#list_cluster_custom_object.

  5. Priyankasaggu11929 commented on Apr 28, 2021

    @Priyankasaggu11929
    Contributor
  6. Priyankasaggu11929 commented on May 2, 2021

    @Priyankasaggu11929
    Contributor

    /assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/documentationCategorizes issue or PR as related to documentation.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions