Configure the network services

To expose a node port for the application you must configure the network services.

  1. List available services by running the following command:
    $ oc get svc
    Example output:
    NAME                                          TYPE           CLUSTER-IP      EXTERNAL-IP                            PORT(S)                           AGE
    headless                                      ClusterIP      None            <none>                                 5434/TCP                          16d
    kubernetes                                    ClusterIP      172.30.0.1      <none>                                 443/TCP                           17d
    openshift                                     ExternalName   <none>          kubernetes.default.svc.cluster.local   <none>                            17d
    rhel9-vm-lb-ssh-service                       LoadBalancer   172.30.138.217  192.0.2.100                            22000:32240/TCP                   21h
    
  2. Edit the required YAML file by running the following command:
    $ oc edit svc <service-name>
  3. Leave the existing nodePort entry unchanged and add new ports for MongoDB without a nodePort entry. By default, RHOCP selects an available port in the `30000-32767` range.
    ports:
    - name: ssh
      nodePort: 32240
      port: 22000
      protocol: TCP
      targetPort: 22
    - name: mongodb
      port: 27017
      protocol: TCP
      targetPort: 27017
  4. Verify that the service node port is updated by running the following command:
    $ oc get svc

    Example output:

    NAME                                          TYPE           CLUSTER-IP      EXTERNAL-IP                            PORT(S)                           AGE
    headless                                      ClusterIP      None            <none>                                 5434/TCP                          16d
    kubernetes                                    ClusterIP      172.30.0.1      <none>                                 443/TCP                           17d
    openshift                                     ExternalName   <none>          kubernetes.default.svc.cluster.local   <none>                            17d
    rhel9-vm-lb-ssh-service                       LoadBalancer   172.30.138.217  192.0.2.100                            22000:32240/TCP,27017:31220/TCP   16s