I'm using docker desktop on windows. I have a docker image with a python web app. I can run a container and access it on my host as http://localhost:9090
Now I'm trying to run it on a Kubernetes cluster with the deployment yaml below.
apiVersion: apps/v1
kind: Deployment
metadata:
name: flask
namespace: dev
labels:
app: flask
spec:
replicas: 3
selector:
matchLabels:
app: flask
template:
metadata:
labels:
app: flask
spec:
containers:
- name: flask
image: myubuntu
imagePullPolicy: Never
resources:
requests:
cpu: "500m"
memory: "500Mi"
ports:
- containerPort: 9090
---
apiVersion: v1
kind: Service
metadata:
name: flask
namespace: dev
spec:
type: NodePort
selector:
app: flask
ports:
- protocol: TCP
port: 9090
targetPort: 9090
then I ran:
kubectl apply -f deployment.yaml
kubectl get service
which gave me:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
flask NodePort 10.110.188.94 <none> 9090:30007/TCP 10m
but I cannot access it from host via
curl http://localhost:9090
curl http://localhost:30007
curl http://10.110.188.94:9090
curl http://10.110.188.94:30007
Does anyone know how I can access the web app from the host?