kubernetesinternalsclamav

Creating an Internal Only Service in Kubernetes


Im trying to create an internal service only within kubernetes. Its a clamav service, the docker container runs on port 3310. I have created a deployment and a service.

I have put the service and deployment in a 'clamav' namespace

I have port forwarded both the service and pods and can confirm it works as expected.

If I connect directly to the pod and run curl localhost:3310 its good, if i curl clamav (no port as ive configured 80 as the incoming service port) (which clamav being the service name) I get the following 503 error:

upstream connect error or disconnect/reset before headers. reset reason: connection termination

If I connect to a different service and try the same curl clamav.clamav I get the same error. (no port as ive configured 80 as the incoming service port)

Do I need something else other than a service and deployment or is something misconfigured?

The service spec is shown below.

spec:
  clusterIP: 10.10.255.194
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 3310
  selector:
    app: clamav
  sessionAffinity: None
  type: ClusterIP

I have tried changing the name to "3310-3310" and changing the port to "3310" as well... had to update the curl commands to have the :3310 for the port... but same error.

Also just to add, I do have the istio service mesh running in this cluster and injected.

Thanks Kevin


Solution

  • The answer to this was the service, changing it to:

    spec:
      clusterIP: 10.10.255.194
      ports:
      - name: tcp-clamav
        port: 80
        targetPort: 3310
      selector:
        app: clamav
      sessionAffinity: None
      type: ClusterIP
    

    Fixed the issue