Kubernetes deployment without a port

1/14/2018

I have a service which is long-running (in a while 1 loop) and processes payloads via GCloud pub/sub, after which it writes the result to a DB.

The service doesn't need to listen on any port.

What would the declarative YAML config look like for Kind=Deployment?

I understand ClusterIP is the default type, and the docs go on to say that a headless service just has to define spec.clusterIP as None.

(A better practice would probably be to modify the worker to exit after a successful payload processing, and change the Kind to Job, but this is in the backlog)

-- opyate
kubernetes

1 Answer

1/14/2018

What you're describing sounds more like a job or a deployment than a service. You can run a deployment (which creates a replicaset, which ensures a certain number of replicas are running) without creating a service.

If your pod isn't exposing any network services for others to consume, there's very little reason to create a service.

-- Jordan Liggitt
Source: StackOverflow