How can I get the port no used by kube-scheduler pod running in kube-system name . . .

Sanjay Kumar:
How can I get the port no used by kube-scheduler pod running in kube-system namespace and save that into kube-port.txt file?

V S Charan kumar Reddy Bakka:
describe the pod, grep for port and then redirect it to the file

Sanjay Kumar:
I tried that command like:

kubectl -n kube-system describe pod kube-scheduler-controlplane | grep-i port

This is the output I am seeing:

Port: <none>
Host Port: <none>
—port=0

Anyone can help in this ?

Mohamed Ayman:
Try with :
netstat -ntlp |grep -i scheduler

Sanjay Kumar:
That will give me multiple rows with the ip and port information even if I just grep -i listen as well.
Any further advice to just get the port only ?

Sanjay Kumar:
That will give me multiple rows with the ip and port information.
I can add just grep -i listen to get the single row.
Any further advice to just get the port only ?

Tej_Singh_Rana:
You can use awk command.