I tried to attach a remote Java process running on Kubernetes for debugging using the Kubernetes extension on VS Code.
After selecting Debug (Attach)
, the port select window is only shown on the first try. Once I set the port, there seems no way to reset this setting. (Sorry, the image is in Japanese)
Is there any way to change the port to be connected?
CodePudding user response:
You can set the type NodePort in your Service Deployment.
You can specify a port in that range specifically by setting the nodePort attribute under the Port object, or the system will chose a port in that range for you.
A Service example with specified NodePort would look like this:
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
name: nginx
spec:
type: NodePort
ports:
- port: 80
nodePort: 30080
name: http
- port: 443
nodePort: 30443
name: https
selector:
name: nginx
You can refer to the document for more details.