Get Ip address of client machine using kubectl

Tanul 1,281 Reputation points
2023-09-13T15:21:00.9966667+00:00

Hello,

We have an Azure VM from where we execute kubectl commands to manage our AKS. Is it possible to get the Ip address of the Azure VM from AKS..

Our Azure VM has only private IP and it doesn't have any public IP attached to it.

We need to figure out that VM machine using which Ip address while calling kube-api server using kubectl. Is there any way we can see the logs?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,210 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,805 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
2,078 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Eddie Neto 1,226 Reputation points Microsoft Employee
    2023-09-13T16:06:21.67+00:00

    Hi @Tanul

    Thanks for reaching Microsoft Q&A

    What are you looking for you need to enable inside of your AKS cluster "Diagnostics Settings" the enable to collect the "Kubernetes API Server". By having those metrics enabled/collection this will have costs, make sure to validate this before to avoid having plenty of logs.

    Once activated you must around 20min to propagate the rules to start collecting logs. Then you can go the logs and run query's to check it and you are going to see the traces of the IP´s.

    User's image

    Hope this helps. Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.