Accessing Flink’s Web UI #

The Flink Kubernetes Operator, by default, does not change the way the native kubernetes integration exposes the Flink Web UI.

Ingress #

Beyond the native options, the Operator also supports creating Ingress entries for external UI access. Ingress generation can be turned on by defining the ingress field in the FlinkDeployment:

  namespace: default
  name: advanced-ingress
  image: flink:1.14.3
  flinkVersion: v1_14
    template: "{{namespace}}/{{name}}(/|$)(.*)"
    className: "nginx"
    annotations: "/$2"

The ingress specification defines a mandatory template field and two optional fields className and annotations. When the CR is submitted, the Operator substitutes the template variables from metadata and creates an Ingress entry on the Kubernetes cluster.
Given the example above the Flink UI could be accessed at and the generated Ingress entry would be:

  kind: Ingress
    annotations: /$2    
    name: advanced-ingress
    namespace: default   
    ingressClassName: nginx
    - host:
    - http:
        - backend:
              name: advanced-ingress-rest
                number: 8081
          path: /default/advanced-ingress(/|$)(.*)
          pathType: ImplementationSpecific

Note: Flink Web UI is built with the popular Angular framework and uses relative path to load static resources, hence the endpoint URL must end with trailing a / when accessing it from browsers through a proxy otherwise the main page appears as blank. In order to support accessing base URLs without a trailing / the URLs can be redirected. When using NGINX as ingress-controller this can be achieved by adding an extra annotation to the Ingress definition: |
if ($uri = "/default/advanced-ingress") {rewrite .* $1/default/advanced-ingress/ permanent;}

Beyond the example above the Operator understands other template formats too:

Simple domain based routing:

  template: "{{name}}.{{namespace}}"    

This example requires that anything * must be routed to the Ingress Controller with a wildcard DNS entry:

kubectl get ingress -A
NAMESPACE   NAME             CLASS   HOSTS                                 ADDRESS        PORTS   AGE
default     sample-job       nginx   80      30m

The Flink Web UI can be accessed at

Simple path based routing:

  template: "/{{namespace}}/{{name}}(/|$)(.*)"    
  annotations: "/$2"

This example requires no DNS entries.

kubectl get ingress -A
NAMESPACE   NAME               CLASS   HOSTS          ADDRESS     PORTS   AGE
default     sample-job         nginx   *              localhost   80      54m

The Flink Web UI can be accessed at https://localhost/defalt/sample-job/

Note: All the examples were created on a minikube cluster. Check the description for easily enabling the NGINX Ingress Controller on minikube.