I'm not sure if you need the scan to be external or if you are okay with an internal scan as well, but either way, you could obtain IP and port by manually requesting them at creation time.
If it is okay to use internal IP and port:
First, for the ClusterIP assigned to a service, it is possible to manually require it (https://kubernetes.io/docs/concepts/services-networking/service/#choosing-your-own-ip-address)
You just need to specify the .spec.clusterIP
field of the Service resource.
Second, for the port you can just use the internal one, the one that you define with:
- port: {{ .Values.web.port }}
If you want to scan it externally at the NodePort port:
First, you can scan the service at whichever node of the cluster, since the NodePort service will expose the communication on all nodes IP Addresses. For the IP you can then just choose one of the cluster's nodes address.
Instead, for the external port, you can specify it manually, simply by adding the optional field:
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767)
nodePort: your_port_here
in the Service declaration.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…