opyate
opyate

Reputation: 5428

Kubernetes deployment without a port

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)

Upvotes: 8

Views: 4787

Answers (1)

Jordan Liggitt
Jordan Liggitt

Reputation: 18161

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.

Upvotes: 7

Related Questions