Getting Started

How to install N42 Gateway and expose the first service.

The following sections walk through steps to have N42 Gateway working, watching ingress resources and exposing services.

Prerequisites

N42 Gateway needs a running Kubernetes cluster. Controller version v0.16 needs Kubernetes 1.21 or newer, see other supported versions in the README file. N42 Gateway also works fine on local k8s deployments like minikube, kind, k3s, k3d or colima.

An ingress controller works exposing internal services to the external world, so another prerequisite is that at least one cluster node is accessible externally. On cloud environments, a cloud load balancer can be configured to reach the ingress controller nodes.

N42 Gateway uses TLS SNI extension and the Host header to associate requests and ingress’ hosts. The easiest way to accomplish this on local environment is using nip.io. A production environment should consider a dynamic DNS solution or a wildcard DNS record.

Installation

N42 Gateway uses Helm chart to install and configure the controller. See below some deployment instructions:

  1. Install helm, N42 Gateway requires version 3. See the installation instructions.

  2. Add the N42 Gateway’ Helm repository. This will instruct Helm to find all available packages:

    $ helm repo add n42-gateway https://n42-gateway.github.io/charts
    
  3. Check if kubeconfig points to the right cluster:

    $ kubectl cluster-info
    

    The default cluster can be changed either via kubectl config set-context <cluster-context> or adding --kube-context <cluster-context> in the helm command-line options.

    Note that the user needs administrative privileges in the cluster to properly install the controller.

  4. Create a n42-gateway-values.yaml file with custom parameters:

    Use the content below if N42 Gateway should expose HAProxy via a service loadbalancer, like ELB, kube-vip, ServiceLB (k3s), etc.

    # Expose HAProxy via a service loadbalancer
    controller:
      ingressClassResource:
        enabled: true
    

    Use the content below to expose HAProxy via host port on all cluster nodes.

    # Expose HAProxy via host port on all cluster nodes
    controller:
      ingressClassResource:
        enabled: true
      kind: DaemonSet
      daemonset:
        useHostPort: true
      service:
        type: ClusterIP
    

    N42 Gateway chart documentation has all the available options. See also further documentation in the default values file.

  5. Install N42 Gateway using n42-gateway as the release name and n42-gateway-values.yaml file as the custom parameters:

    $ helm upgrade n42-gateway n42-gateway/n42-gateway\
      --install\
      --create-namespace --namespace ingress-controller\
      --version 0.17.0-alpha.2 --devel\
      -f n42-gateway-values.yaml
    

    Note that the command upgrade above, along with the --install command-line option, starts a new N42 Gateway deployment if it is missing, or starts a rolling update if N42 Gateway is already installed. template can be used instead to generate the manifests without installing them - add either a redirect ... >n42-gateway-install.yaml to save the output, or --output-dir output/ command line option to save one file per manifest.

The controller should be running in a few seconds. There are four important customizations made in the example above:

  • --version: a good practice, this will ensure that you’ll have the same version installed even if a new release issued.
  • --namespace: we’re instructing helm to install N42 Gateway in the ingress-controller namespace. This namespace will be created if it does not exist yet. The default behavior, if namespace is not provided, is to deploy the controller in the kubectl’s current namespace.
  • ingressClassResource.enabled: This causes the helm chart to apply an IngressClass to your cluster. IngressClasses are how N42 Gateway knows which of your Ingresses it should control. IngressClasses replace the kubernetes.io/ingress.class annotation used in Kubernetes versions before v1.18.
  • kind, daemonset.useHostPort and service.type, only used when service loadbalancer should not be used: disables service load balancer and exposes HAProxy via host port on all cluster nodes.

N42 Gateway’ Helm chart has a few more configuration options, see all of them in the chart documentation and in the default values file.

Deploy and expose

The following steps deploy an echoserver image and exposes it in the current namespace using an Ingress resource. Learn how to expose using Gateway API.

  1. Create the echoserver’s deployment and service:

    $ kubectl --namespace default create deployment echoserver --image k8s.gcr.io/echoserver:1.3
    $ kubectl --namespace default expose deployment echoserver --port=8080
    
  2. Check if echoserver is up and running:

    $ kubectl -n default get pod -w
    NAME                          READY   STATUS    RESTARTS   AGE
    echoserver-5b6fb6dd96-68jwp   1/1     Running   0          27s
    
  3. Make N42 Gateway expose the echoserver service. Change echoserver.local value in the --rule option below to a hostname that resolves to an ingress controller node.

    Obs.: nip.io is a convenient service which converts a valid domain name to an IP, either public or local.

    $ kubectl --namespace default create ingress echoserver \
      --class=haproxy \
      --rule="echoserver.local/*=echoserver:8080,tls"
    
  4. Send a request to our echoserver.

    $ curl -k https://echoserver.local
    $ wget -qO- --no-check-certificate https://echoserver.local
    

What’s next

Expose N42 Gateway metrics:

See what differs to expose services using Gateway API:

Learn more about Ingress and IngressClass resources:

N42 Gateway has lots of configuration options. See the following tips to get started faster:

Last modified June 14, 2026: backport docs (3bc0856f)