1

Get kubernetes node IP or label that agent is running on

We use kubernetes agents to run our pipelines.  Does anyone know if there is a way to get what minion node the agent is running on without kubectl? Does the kubernetes plugin write an environment variable?

2 comments

  • 0
    Avatar
    Allan Burdajewicz

    Hello Donald,

    You can use the environment variable 'NODE_NAME' and 'NODE_LABELS' to get respectively the name and the labels of the node.

    To get the pod IP, you can use a shell script:

    hostname -i

    But to get the host IP you would need to use kubectl.

    Regards,

  • 0
    Avatar
    Donald Kallman

    That's what I figured, thank you

Please sign in to leave a comment.