kubectl get svc --all-namespaces -o go-template='{{range .items}}{{range.spec.ports}}{{if .nodePort}}{{.nodePort}}{{"
"}}{{end}}{{end}}{{end}}'
This gets all services in all namespaces, and does basically: "for each service, for each port, if nodePort is defined, print nodePort".
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…