# The services in a Kubernetes cluster are discoverable inside other containers
# via environment variables.

# An alternative is to use the cluster's DNS service, if it has been enabled for
# the cluster. This lets all pods do name resolution of services automatically,
# based on the service name.
apiVersion: v1
kind: Service
metadata:
  name: zookeeper-svc-1
  labels:
    name: zookeeper-svc-1
    tool: zookeeper

spec:
  ports:
  - name: client
    # on which port listen to service traffic
    port: 2181
    # which port to forward on - can be omitted if we want to forward to same "port"
    targetPort: 2181
    nodePort: 0
    protocol: TCP

  - name: peer
    port: 2888
    targetPort: 2888
    nodePort: 0
    protocol: TCP

  - name: leaderelection
    port: 3888
    targetPort: 3888
    nodePort: 0
    protocol: TCP

  selector:
    name: zookeeper
    server: zookeeper-server-1
