Hi, I would like to connect two backend pods with axios For each pod I have a deployment.yaml file and a cluster-ip-service.yaml file. One of the pod need to get data from the other pod via axios. I use Ingress for traffic When I call
axios.get(my-cluster-ip-service/endpoint)
it can’t resolve my-cluster-ip-service
The first pod deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: podA-deployment
spec:
replicas: 1
selector:
matchLabels:
component: podA
template:
metadata:
labels:
component: podA
spec:
containers:
- name: podA
image: podA/img
ports:
- containerPort: 5000
The first pod service
apiVersion: v1
kind: Service
metadata:
name: podA-cluster-ip-service
spec:
type: ClusterIP
ports:
- port: 5000
targetPort: 5000
selector:
component: podA
The second pod deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: podB-deployment
spec:
replicas: 1
selector:
matchLabels:
component: podB
template:
metadata:
labels:
component: podB
spec:
containers:
- name: podB
image: podB/img2
ports:
- containerPort: 5000
The second pod service
apiVersion: v1
kind: Service
metadata:
name: podB-cluster-ip-service
spec:
type: ClusterIP
ports:
- port: 5000
targetPort: 5000
selector:
component: podB
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi, I have finally resolved the issue. By doing that it was showing me an EINVAL error. I had to put http before
Thank you !
Hi there @cheikhseck980,
What happens when you try to use the service name itself? For example if your pod A need to get data from pod B, what is the result when you do
axios.get(podB-cluster-ip-service/endpoint)
from pod A?Regards, Bobby