У меня есть приложение Python и приложение Vue-JS в Minikube.Я попытался сделать службу сообщений в python, упомянув «python-app-service» в URL, но все же vue js применяет это как буквальный «python-app-service» вместо IP-адреса.
допустим, это мое развертывание под названием python-server
:
spec:
containers:
- image: python-server:latest
imagePullPolicy: IfNotPresent
name: python-servier
ports:
- containerPort: 8001
name: python-server
, а мой сервис называется python-server-service
spec:
ports:
- port: 8001
targetPort: 8001
С другой стороны, у меня естьаналогичный вид deploymet и службы для Vue JS.
Теперь я хочу сделать аксиальный пост-запрос в vue js к python-server
:
axios.post('python-server-service'+'/api/new/post',
this.name, // the data to post
{ headers: {
'Content-type': 'application/x-www-form-urlencoded',
}
}).then(response => ....);
вместо этого:
axios.post('http://127.0.0.1:3030/api/new/post',
this.name, // the data to post
{ headers: {
'Content-type': 'application/x-www-form-urlencoded',
}
}).then(response => ....);
Но, к сожалению, vueJS будетне удается разрешить мой python-server-service
и поместить его в виде буквенной строки "python-server-service".
Как я могу получить IP-адрес python-app-service в vuejs, работающем в minikube?
Спасибо.