Skip to content

Expose your app

To expose your application within your K8SaaS cluster, you need to configure an Ingress. Start by creating an Ingress configuration file, as shown in the example below. This configuration exposes the sample-service Service http named port at sampleapp.$YOUR_DOMAIN_NAME.

For more information on the ref+file syntax, refer to the config & secrets page.

ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: sample-ingress
spec:
ingressClassName: ref+file://config.yaml#/ingress/defaultClass+
rules:
- host: sampleapp.ref+file://config.yaml#/ingress/domainName+
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: sample-service
port:
name: http

In order to generate a certificate and enable TLS for your application, you need to add a specific cert-manager annotation in your application ingress configuration.

Ensure the secret name is unique to this Ingress resource. It helps to prevent conflicts or retry loops. A recommended way to naming your ingress is to include the application name or domain in the secret name. e.g. tls-sampleapp.

ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: ref+file://config.yaml#/ingress/defaultClusterIssuer+
...
spec:
...
tls:
- hosts:
- sampleapp.ref+file://config.yaml#/ingress/domainName+
secretName: tls-sample

To expose your application through Forecastle and have it automatically appear in the dashboard, include the following annotations in your Ingress configuration:

ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
forecastle.stakater.com/expose: "true"
forecastle.stakater.com/appName: "SampleApp"
forecastle.stakater.com/group: "Demo"
forecastle.stakater.com/icon: "https://i.imgur.com/VMhXf6z.jpeg"
...

Here is an example of a complete Ingress configuration.

This contains the whole networking config, such as basic exposition, TLS configuration and Forecastle integration.

ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: <ingress-name>
annotations:
cert-manager.io/cluster-issuer: ref+file://config.yaml#/ingress/defaultClusterIssuer+
forecastle.stakater.com/expose: "true"
forecastle.stakater.com/appName: "<app-name>"
forecastle.stakater.com/group: "<app-group>"
forecastle.stakater.com/icon: "<icon-url>"
spec:
ingressClassName: ref+file://config.yaml#/ingress/defaultClass+
rules:
- host: <app-subdomain>.ref+file://config.yaml#/ingress/domainName+
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: <service-name>
port:
name: http
tls:
- hosts:
- <app-subdomain>.ref+file://config.yaml#/ingress/domainName+
secretName: tls-<app-name>

Once the configuration is complete, navigate to the Forecastle UI to verify your application. Your application should appear in the dashboard, accessible via HTTPS. If you can successfully access it, your Ingress configuration has been provisioned correctly.