2 Installing the NGINX Ingress Controller Module

This chapter discusses how to install the NGINX Ingress Controller module on Oracle Cloud Native Environment.

Prerequisites

This section contains the prerequisites for installing the NGINX Ingress Controller module.

Load Balancer

The NGINX Ingress Controller needs a load balancer. You must provide a load balancer service in the environment. You don't need to create a load balancer (one is created for you when you install the NGINX Ingress Controller module), but you must install a module that provides one.

You can use MetalLB for bare metal environments, or the Oracle Cloud Infrastructure load balancer when using Oracle Cloud Infrastructure.

For information on installing MetalLB, see MetalLB Module.

For information on installing the Oracle Cloud Infrastructure Cloud Controller Manager module, see Oracle Cloud Infrastructure Cloud Controller Manager Module.

Deploying the NGINX Ingress Controller Module

You can deploy all the modules required to set up the NGINX Ingress Controller module using a single olcnectl module create command. This method might be useful to deploy the NGINX Ingress Controller module at the same time as deploying a Kubernetes cluster.

If you have an existing deployment of the Kubernetes module, you can specify that instance when deploying the NGINX Ingress Controller module.

This section guides you through installing each component required to deploy the NGINX Ingress Controller module.

For the full list of the Platform CLI command options available when creating modules, see the olcnectl module create command in Platform Command-Line Interface.

To deploy the NGINX Ingress Controller module:

  1. If you don't already have an environment set up, create one into which the modules can be deployed. For information on setting up an environment, see Installation. The name of the environment in this example is myenvironment.

  2. If you don't already have a Kubernetes module set up or deployed, set one up. For information on adding a Kubernetes module to an environment, see Kubernetes Module. The name of the Kubernetes module in this example is mycluster.

  3. Create an NGINX Ingress Controller module and associate it with the Kubernetes module named mycluster using the --ingress-nginx-kubernetes-module option. In this example, the NGINX Ingress Controller module is named myingress-nginx.

    olcnectl module create \
    --environment-name myenvironment \
    --module ingress-nginx \
    --name myingress-nginx \
    --ingress-nginx-kubernetes-module mycluster 

    The --module option sets the module type to create, which is ingress-nginx. You define the name of the NGINX Ingress Controller module using the --name option, which in this case is myingress-nginx.

    The --ingress-nginx-kubernetes-module option sets the name of the Kubernetes module.

    If you're using the Oracle Cloud Infrastructure Cloud Controller Manager module to provide a load balancer, include the --ingress-controller-service-annotations option to configure a load balancer to use with the NGINX Ingress Controller. The load balancer is created when you install the module.

    --ingress-controller-service-annotations {annotation,...}

    For example, some options to provision an Oracle Cloud Infrastructure load balancer might include the following, in a comma separated list:

    service.beta.kubernetes.io/oci-load-balancer-shape: flexible
    service.beta.kubernetes.io/oci-load-balancer-shape-flex-max: "100"
    service.beta.kubernetes.io/oci-load-balancer-shape-flex-min: "10"
    service.beta.kubernetes.io/oci-load-balancer-internal: "true"

    In some Oracle Cloud Infrastructure tenancies, you might also need to include the oci-load-balancer-subnet1 annotation to identify the network subnet, for example:

    service.beta.kubernetes.io/oci-load-balancer-subnet1: "ocid1.subnet.oc1..unique_ID" 

    For the full list of annotations you can include, see the upstream documentation.

    If you don't include all the required options when adding the module, you're prompted to provide them.

  4. Use the olcnectl module install command to install the NGINX Ingress Controller module. For example:

    olcnectl module install \
    --environment-name myenvironment \
    --name myingress-nginx

    You can optionally use the --log-level option to set the level of logging displayed in the command output. By default, error messages are displayed. For example, you can set the logging level to show all messages when you include:

    --log-level debug

    The log messages are also saved as an operation log. You can view operation logs as commands are running, or when they've completed. For more information using operation logs, see Platform Command-Line Interface.

    The NGINX Ingress Controller module is deployed into the Kubernetes cluster.

Verifying the NGINX Ingress Controller Module Deployment

You can verify the NGINX Ingress Controller module is deployed using the olcnectl module instances command on the operator node. For example:

olcnectl module instances \
--environment-name myenvironment

The output looks similar to:

INSTANCE                         MODULE                   STATE    
mycluster                        kubernetes               installed
myingress-nginx                  ingress-nginx            installed
...

Note the entry for ingress-nginx in the MODULE column is in the installed state.

In addition, use the olcnectl module report command to review information about the module. For example, use the following command to review the NGINX Ingress Controller module named myingress-nginx in myenvironment:

olcnectl module report \
--environment-name myenvironment \
--name myingress-nginx \
--children

For more information on the syntax for the olcnectl module report command, see Platform Command-Line Interface.

On a control plane node, verify the NGINX Ingress Controller deployment is running in the ingress-nginx namespace:

kubectl get deployments --namespace ingress-nginx

The output looks similar to:

NAME                         READY   UP-TO-DATE   AVAILABLE   AGE
myingress-nginx-controller   1/1     1            1           10m

You can also show the settings in the ConfigMap, for example:

kubectl describe configmaps --namespace ingress-nginx myingress-nginx-controller

The output looks similar to:

Name:         myingress-nginx-controller
Namespace:    ingress-nginx
Labels:       app.kubernetes.io/component=controller
              app.kubernetes.io/instance=myingress-nginx
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=ingress-nginx
              app.kubernetes.io/part-of=ingress-nginx
              app.kubernetes.io/version=1.9.6
              helm.sh/chart=ingress-nginx-4.9.1
Annotations:  meta.helm.sh/release-name: myingress-nginx
              meta.helm.sh/release-namespace: ingress-nginx

Data
====
allow-snippet-annotations:
----
false

BinaryData
====

Events:
  Type    Reason  Age   From                      Message
  ----    ------  ----  ----                      -------
  Normal  CREATE  11m   nginx-ingress-controller  ConfigMap ingress-nginx/myingress-nginx-controller

Verify the NGINX Ingress Controller service is running in the ingress-nginx namespace:

kubectl get service --namespace ingress-nginx

The output looks similar to:

NAME                                   TYPE           CLUSTER-IP       EXTERNAL-IP      PORT(S)                      AGE
myingress-nginx-controller             LoadBalancer   10.104.157.191   203.0.113.11     80:30154/TCP,443:30394/TCP   12m
myingress-nginx-controller-admission   ClusterIP      10.105.18.193    <none>           443/TCP                      12m

You can also show the settings in the service, for example:

kubectl describe service --namespace ingress-nginx myingress-nginx-controller