# -------------------
# yaml configuration to define a NodePort service for the Bar server
# -------------------

apiVersion: v1
kind: Service

metadata:
  # the namespace is referred
  namespace: bar-nspace
  name: bar-service-nport

spec:
  selector:
    name: bar-service

  # service type is NodePort
  type: NodePort

  ports:
    # port is used to communicate within the cluster
  - port: 4050
    # the target port points to the server's port
    targetPort: 4000
    # nodeport that can be accessed from outside the cluster
    nodePort: 30040
