Get Ip address of client machine using kubectl

Tanul 1,221 Reputation points


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.
2,324 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
5,937 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.
1,551 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Eddie Neto 1,076 Reputation points Microsoft Employee

    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.