title: Can same service be launched in 2 different namespaces with type nodeport on the same port?
body: <p>I have a kubernetes cluster set up in a private cloud. Idea is all the developers would be using this cluster to launch all the microservices needed for the app. Each developer would launch all the deployments/services in his namespace to avoid collision. Since this cloud doesn't support LoadBalancer , I have used nodePort with a port defined to expose external IP for the front end. And I access the front end using </p>
  
  <p><a href="http://node-ip:port" rel="nofollow noreferrer">http://node-ip:port</a></p>
  
  <p>However Since K8s can launch any number of front-end pods of different namespaces on the same node -I will have a collision because that nodePort is already assigned to the service launched first. I now cant understand on how can I allow multiple people using same services to launch in the same cluster.</p>
  
  <p>Sample Service Config is below</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: frontend
    labels:
      name: frontend
  spec:
    ports:
    - port: 8884
      targetPort: 8081
      nodePort: 30080
      name: ui
    selector:
      app: test
    type: NodePort
  </code></pre>
  
  <p>This frontend service can be accessed by <a href="http://node-ip:30080" rel="nofollow noreferrer">http://node-ip:30080</a> if run for the first time. What happens if we run the same yaml across different namespace in the same node? How do we resolve this?</p>