kontena / akrobateo

Akrobateo is a simple Kubernetes operator to expose in-cluster LoadBalancer services as node hostPorts using DaemonSets.
Apache License 2.0
110 stars 15 forks source link

Select between daemonset and deployment #16

Open jnummelin opened 5 years ago

jnummelin commented 5 years ago

Using a DaemonSet for LB pods means that a given port can be mapped only in single service per cluster. Then again, a daemonset gives maximum availability. When there's lot of nodes in the cluster a daemonset also results in huge list of external addresses in the service status.

It would be nice to allow the user to select between a deployment and daemonset. The only viable way to configure such things is via annotations on the service. I'd propose the following way:

apiVersion: v1
kind: Service
metadata:
  name: echoserver
  annotations:
    akrobateo.kontena.io/type: deployment # or daemonset
spec:
  type: LoadBalancer
  ports:
  - name: echo
    port: 8080
    targetPort: 8080
    protocol: TCP
  selector:
    app: echoserver