Skip to content
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@eduardborges @pleshakov @damiancurry @SirNexus
95 lines (73 sloc) 3.58 KB

Installing the NGINX Router


  • Build the Router image and upload it to your private registry. Please see the instructions here.
  • It is important to upload the image to the private registry before deleting the default Router, as it will render the registry unavailable.

1. Log into the OpenShift Cluster

  1. Log in as admin:

    $ oc login -u system:admin
  2. Select the default project:

    $ oc project default

2. Delete the Default Router

  1. Back up the default Router config, in case it needs to be recreated:

    $ oc get -o yaml service/router dc/router clusterrolebinding/router-router-role serviceaccount/router > default-router-backup.yaml
  2. Delete the Router:

    $ oc delete -f default-router-backup.yaml

3. Deploy the NGINX Router

  1. Deploy the NGINX Router:

    $ oc adm router router --images=docker-registry.default.svc:5000/openshift/nginx-openshift-router:0.2 --type='' --selector=''


    • The selector parameter specifies a label selector for nodes where the Router will be deployed: Use a selector that makes sense for your environment.
  2. Run the following command to make sure that the Router pods are running:

    $ oc get pods

    You should see a Router pod with the name router-1-<string>.

4. Access the Stub Status Page

  1. By default, the NGINX stub status page is available via port 1936 of the node where the Router is running (you can change this port with the STATS_PORT env variable). To access the page outside of the node, you need to add an entry to the IPtables rules for that node:
    $ sudo iptables -I OS_FIREWALL_ALLOW -p tcp -s <ip range> -m tcp --dport 1936 -j ACCEPT 
  2. Open your browser at http://<node-ip>:1936/stub_status to access the stub status page.

5. Support for Prometheus Monitoring

If you are using Prometheus, you can deploy the NGINX Prometheus Exporter with the NGINX Router to export the NGINX metrics into Prometheus. To add the exporter to the Router:

  1. Patch the Router deployment configuration to add the exporter container to the Router pod:

    $ oc patch dc/router -p 'spec:
          - image: nginx/nginx-prometheus-exporter:0.1.0
            name: nginx-prometheus-exporter
            - name: prometheus
              containerPort: 9113
              - -web.listen-address
              - :9113
              - -nginx.scrape-uri

    The exporter will make the metrics available on port 9113.


    • Change port 1936 in the patch command if the Router was configured to expose the status on a different port other than the default port 1936.
  2. Annotate the Router service to indicate to Prometheus to automatically scrape the metrics from the Router endpoints through port 9113:

    $ oc annotate service router --overwrite


    • Your Prometheus must be configured to automatically discover targets through the annotations and applied to a service.

Uninstall the NGINX Router

  • Delete the NGINX Router:
    $ oc delete service/router dc/router clusterrolebinding/router-router-role serviceaccount/router
You can’t perform that action at this time.