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)
containerPort. The containerPort option is optional and tells the service to forward the traffic from the service port (defined in port ) to a different containerPort of a pod.
To cancel or quit the kubectl command, you can simply press Ctrl + C and the port forwarding will end immediately.
“containerPort” defines the port on which app can be reached out inside the container. once your container is spun up and the pod is running. You may need to expose the POD as a service to the external world sometimes. Kubernetes service comes into the picture here.
The ports required for a Kubernetes deployment are: 2379/tcp: Kubernetes etcd server client API (on master nodes in multi-master deployments) 2380/tcp: Kubernetes etcd server client API (on master nodes in multi-master deployments) 6443/tcp: Kubernetes API server (master nodes)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With