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 https://docs.docker.com/registry/deploying/:
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 :
spec:
ports:
- name: “8543”
port: 8543
targetPort: 5432
selector:
io.kompose.service: db
the container port in the db-deployment.yaml :
ports:
- containerPort: 5432
the ports in the api-service.yaml (relative to backend) :
ports:
- name: “8000”
port: 8000
targetPort: 8000
selector:
io.kompose.service: api
and the port in the api-deployment.yaml (relative to backend):
ports:
- containerPort: 8000