NAPPTIVE ingress

The napptive-ingress trait creates an Ingress to make the component publicly available to the Internet. The resulting ingress will automatically be given a valid DNS name and associated TLS certificate so that it can be consumed by all major browsers without modification.

The public URL where the component will be exposed will be injected in the target container as an environment variable named NAPPTIVE_URL, or NAPPTIVE_CUSTOM_URL in the case of defining an extraDNSName.

The following snippet shows an example application with a napptive-ingress trait to expose an HTTP route on port 80 of the target component. Notice that a https route will be automatically created as major browsers automatically switch to the secure route.

kind: Application
  name: my-app
    version: "v0.0.1"
    description: "My apply-application application"
    - name: component
      type: webservice
        image: my-app-image:v1.0.0
        - port: 80
          expose: true
      - type: napptive-ingress # Set to napptive-ingress      
          name: nginx-ingress # (Optional) endpoint name 
          port: 80 # (Required) port  where the service is listening for incoming connections.
          path: / # (Required) path to be exposed
          rewritePath: / # (Optional) rewrite rule if one is needed.
          targetServiceName: service # (Optional) name of the service associated with the endpoint
          extraDNSName: # (Optional) additional DNS name in which this ingress must accept traffic
          requestBodySize: 10m # (Optional) Modify the maximum request size. This could be useful for scenarios requiring uploading files.
          writeURLToConfigMap: my-cm # (Optional) Name of the configmap that will be generated with the associated URLs 

Using the injected environment variables in other variables

Some containers may require this information to be available through other environment variables. For that case, you should add the required environment variables using the env trait. Notice that it is important that this type of variables are added after the ingress one, or Kubernetes will fail to detect them.

  - type: env
        name: MY_CUSTOM_CFG
        value: $(NAPPTIVE_URL)

Storing the associated URL in a configmap

Some applications may require several components to have access to the final exposed endpoint for configuration purposes. To accomplish this, use the writeURLToConfigMap property of the ingress trait to generate a configmap map with the following keys, that can be mounted by other components as environment variables for their configuration.

Key Description
URL URL associated with the endpoint without the protocol.
CUSTOM_URL URL associated with the extraDNSName property.

Frequently Asked Questions (FAQ)

My application returns 503

The ingress will automatically redirect requests to the component even if the component has just started. Please wait some time depending on the image being executed so that the component is fully up and running.

I expected an http:// endpoint and got https://

Major browsers implement HTTP Strict Transport Security (STS) which translates in automatic promotion of plain requests to https://. We recommended adapting the client consuming the service to support TLS. Alternatively, check your browser documentation to see whether it is possible to switch off this protection layer.

Can I use a custom domain for my application?

The napptive-ingress trait supports custom domains to expose an application with the extraDNSName property. For more information, follow our guide of setting up a custom domain for an application.