I happen to have a test project that is created in angular 17 and communicates with a python backend.
The thing is that I would like the communication to happen internally through the python service but when I use as host :
this.http.get('http://service-a:5000/message', { responseType: 'text' })
.subscribe(data => this.messageA = data);`
To connect to the back I get an error in the browser ERR_NAME_NOT_RESOLVED, I have tried to access the pod with angular and do a wget with the same url
wget -qO- http://service-a:5000/message
Hello from Service A!
It returns correctly the response from the api but when I try to do it from the browser it only throws errors
Does anyone know how I can communicate internally using the service? I leave the deployment.yaml for you to see it.
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: frontend-angular:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: frontend
spec:
ports:
- port: 80
targetPort: 80
selector:
app: frontend
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: service-a
spec:
replicas: 1
selector:
matchLabels:
app: service-a
template:
metadata:
labels:
app: service-a
spec:
containers:
- name: service-a
image: service-a:latest
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: service-a
spec:
ports:
- port: 5000
targetPort: 5000
selector:
app: service-a
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: service-b
spec:
replicas: 1
selector:
matchLabels:
app: service-b
template:
metadata:
labels:
app: service-b
spec:
containers:
- name: service-b
image: service-b:latest
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: service-b
spec:
ports:
- port: 5000
targetPort: 5000
selector:
app: service-b
communicate internally using the service
user26492738 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.