Containers in a Kubernetes cluster don't seem to communicate

Cluster information:

Kubernetes version:1.25
Cloud being used:
Installation method:
Host OS: Linux
CNI and version:
CRI and version:

Hi guys, i’m new to the world of containerized apps with Docker and Kubernetes. Substantially i have to make a migration from Docker to Kubernetes of an already written application. I converted the docker-compose.yaml file with :
$ kompose convert -f docker-compose.yaml
and i got my deployments, persistenVolume and service yaml files. I also have to use a localhost registry, and i successfully created once as the official docker documentation suggest at

docker run -d -p 5000:5000 --restart=always --name registry registry:2

I tagged and pushed my images correctly to localhost:5000 and my pods are running correctly.
However i can’t make them communicate correctly, i guess it’s a problem with ports from the Docker environment to the Kubernetes one, and i think it’s mainly for the clusterIP service that Kubernetes uses. In specific words, i have a pod that runs a container with a Postgres db on it, and another one that runs the backend logic and needs to access the db.
Here are the ports specified in the db-service.yaml :

- name: “8543”
port: 8543
targetPort: 5432
io.kompose.service: db

the container port in the db-deployment.yaml :

- containerPort: 5432

the ports in the api-service.yaml (relative to backend) :

- name: “8000”
port: 8000
targetPort: 8000
io.kompose.service: api

and the port in the api-deployment.yaml (relative to backend):
- containerPort: 8000

You didn’t say anything about networking or how your cluster was created, so it’s a wild guess.

Try this: Debug Services | Kubernetes

Ye sorry i am using docker desktop on windows and i manage the cluster from the WSL with the kubectl apply. Hope i understood what i was missing

I have no hands-on experience with Docker desktop or Windows, really, so I can’t help too much. That doc details steps to figure out why services might not work, but it presupposes that the pod-to-pod network is correct, which is what I don’t know in your context.

The services are all clusterIP and i think it’s the main problem to handle in port configuration. Maybe this additional info can say you somethinq? Anyway, thanks for the attention!

Run thru that doc. Nothing seems obviously wrong in your config (as long as your apps are actually listening on 5432 and 8000, respectively).