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!
Accepted Answer
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.