Search code examples
kuberneteskubectl

closing a port in a running kubernetes service


Im trying to create a load balancer service in kubernetes which will have 2 ports: 80 and 8080. For the port 80 I want to open this port only when I want to use it. Is it possible to do this while the service is running?

Im trying to use 8080 for serving outside requests and 80 for debugging purpose.


Solution

  • I would suggest not exposing the debugging port at all by means of service (aspecially that you dont really know it will hit the same backing pod as port for real traffic). Instead it might be good enough for you to use kubectl port-forward to access the debug port when you need.