0
votes

I am deploying a stream with Spring SCDF. This stream also has a LoadBalancer. I activated that with the

spring.cloud.deployer.kubernetes.createLoadBalancer true

stream Deployer property. So this LoadBalancer does work now and gives me an external IP that I can access. However this IP is changing each time I am redeploying the stream.

I am using GCP and there am able to provide a static IP. In Kubernetes I can give an ingress a static IP like so:

annotations:
    kubernetes.io/ingress.global-static-ip-name: "web-static-ip"

I wonder how I can do the same for a deployed stream with Spring SCDF now?

1
Why you don't use ingress in front of the deployment? That way LB will be always there even when you redeploy the stream.Crou
@Crou you mean deploying an ingress before we deploy the streams? That is an idea but the problem is that Spring SCDF is deploying it's deployment resources with a suffix'ed name like my-source-dev-43. We were not able to find a way to get rid of that naming (see: stackoverflow.com/questions/58734738/…). Because of that we can't connect the Ingress to a service since the name is changing with every redeployed streamxetra11

1 Answers

2
votes

In a production deployment setting, you'd want to have an explicit load-balancer (LB) attached to the desired application, so its service can be invoked by other services because there will be a static URL/IP to interact with it. Even if the app is rolling-upgraded or redeployed, you will get a predictable URL/IP.

Here's an example of the LB deployment:

kind: Service
apiVersion: v1
metadata:
  name: FOO-lb
  namespace: kafkazone
spec:
  ports:
  - port: 80
    name: http
    targetPort: 8080
  selector:
    FOOZ: BAR-APP
  type: LoadBalancer

This deployment would produce a URL/IP. Let's say, for example, the IP address of FOO-lb is: 10.20.30.40.

And, when you deploy the stream, you can attach a label selector to the desired application [e.g.: deployer.<yourapp>.kubernetes.deploymentLabels=FOOZ: BAR-APP], so all the incoming traffic to 10.20.30.40 will automatically be received by the source. You will be, of course, relying on the specific IP to post data or interact with it, and it will not change.