Search code examples
spring-cloud-dataflow

How to create route/ingress for apps deployed via spring cloud data flow in kubernetes


We are working on setting up Spring cloud data flow in kubernetes cluster. Wanted to know how we can enable external access to deployed apps from outside the cluster.

We are basically migrating from PCF into kubernetes environment and PCF does have a domain i can specify, but i do not see an equivalent on a kubernetes deployment.

I saw a couple of references to using this deployer property

deployer..kubernetes:createLoadBalancer: true

But the external ip is in pending, there was also some reference about using kubernetes.serviceType: NodePort

but do not see it affecting my deployment and deployer properties when viewed from scdf dashboard doesnt show a property for this one.

So basically, i would like to know how I can create a PCF route equivalent for k8s deployed pods of a stream definition deploy.


Solution

  • As an example: If you deploy a stream using the standard stream application http sink then you add deployer.http.kubernetes.createLoadBalancer=true to the deployment properties. The application will be deployed with LoadBalancer type on the Service and will exposed an external address assuming your cluster has a load balancer attached.

    Assuming the stream is named httplogger using curl and jq to extract the url will look like this:

    JSON=$(curl -s $DATAFLOW_URL/runtime/streams/httplogger)
    URL=$(jq -r '._embedded.streamStatusResourceList[0] | .applications._embedded.appStatusResourceList | .[] | select(.name == "http") | .instances._embedded.appInstanceStatusResourceList[0] | .attributes.url')