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
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.
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?
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now