app-service.yaml
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: app
name: app
spec:
type: NodePort
ports:
- name: "5000"
port: 5000
targetPort: 5000
nodePort: 31000
selector:
io.kompose.service: app
status:
loadBalancer: {}
app-deploy.yaml
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: app
name: app
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: app
spec:
containers:
- image: jithinchowdary/todo_app:latest
name: app
ports:
- containerPort: 5000
resources: {}
restartPolicy: Always
selector:
matchLabels:
io.kompose.service: app
status: {}
mongodb-service.yaml
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: mongodb
name: mongodb
spec:
ports:
- name: "27017"
port: 27017
targetPort: 27017
selector:
io.kompose.service: mongodb
status:
loadBalancer: {}
mongodb-deploy.yaml
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.16.0 (0c01309)
creationTimestamp: null
labels:
io.kompose.service: mongodb
name: mongodb
spec:
replicas: 1
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
io.kompose.service: mongodb
spec:
containers:
- image: mongo
name: mongodb
ports:
- containerPort: 27017
resources: {}
restartPolicy: Always
selector:
matchLabels:
io.kompose.service: mongodb
status: {}
использовал kompose convert для генерации файлов, docker образы успешно построены, сервер работает нормально на порту 5000, вошел в программу реагирования приложения и попытался запустить сервер, ошибка порта уже в использование, что означает, что сервер работает, все еще не может получить доступ к приложению, не может получить доступ через порт 31000, express сервер развернут на 5000, пн go 27017
NAME READY STATUS RESTARTS AGE
pod/app-5944bf6886-jz79l 1/1 Running 0 80m
pod/mongodb-847948b5f-2clvp 1/1 Running 0 79m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/app NodePort 10.106.129.159 <none> 5000:31000/TCP 80m
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 83m
service/mongodb ClusterIP 10.107.146.128 <none> 27017/TCP 79m
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/app 1/1 1 1 80m
deployment.apps/mongodb 1/1 1 1 79m
NAME DESIRED CURRENT READY AGE
replicaset.apps/app-5944bf6886 1 1 1 80m
replicaset.apps/mongodb-847948b5f 1 1 1 79m
curl 10.106.129.159:5000
ccurl: (7) Failed to connect to 10.106.129.159 port 5000: Operation timed out```