У меня есть модуль, запускающий приложение Flask в python, которое прослушивает порт 8083. Если я получаю доступ к приложению изнутри модуля, оно работает:
kubectl exec gen-759dcfd789-hscbr -c gen-pod -- curl http://localhost:8083
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
[...]
Но когда я найдите IP-адрес модуля
kubectl describe pod gen-759dcfd789-hscbr
Name: gen-759dcfd789-hscbr
Namespace: default
Priority: 0
Node: [...]
Start Time: Wed, 15 Apr 2020 19:18:12 +0200
Labels: app=gen
pod-template-hash=759dcfd789
Annotations: <none>
Status: Running
IP: 10.1.45.187
IPs:
IP: 10.1.45.187
Controlled By: ReplicaSet/gen-759dcfd789
и попробуйте получить к нему доступ снаружи модуля
curl http://10.1.45.187:8083
curl: (7) Failed to connect to 10.1.45.187 port 8083: Conexión rehusada
Не удается подключиться.
Я сделал то же самое с другие приложения работают в nodejs, и они работают правильно. Что здесь может происходить? Как я могу отладить, почему он не подключается? Заранее спасибо.
Я уезжаю сюда из ямля:
apiVersion: apps/v1
kind: Deployment
metadata:
name: gen
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: gen
template:
metadata:
labels:
app: gen
spec:
containers:
- name: gen-pod
image: roxax19/python3.7:0.1
command:
- bash
- "-c"
- python3.7 gen.py
volumeMounts:
- mountPath: /mount
name: test-volume
volumes:
- name: test-volume
hostPath:
# directory location on host
path: /home/manuel/tfg/mounts/gen
# this field is optional
type: Directory