我正在尝试将minikube
上运行的一个应用程序暴露给外部世界。我已经使用了一个Nodeport
,我可以使用 Web 浏览器在同一台 hist 机器中访问该应用程序。
但是我需要将此应用程序公开给我的一个住在很远的朋友,这样他也可以在浏览器中看到它。
这就是我的deployment.yaml
文件的样子,我应该使用入口还是如何使用ingress
来做到这一点?
apiVersion: apps/v1
kind: Deployment
metadata:
name: node-web-app
spec:
replicas: 2
selector:
matchLabels:
name: node-web-app
template:
metadata:
labels:
# you can specify any labels you want here
name: node-web-app
spec:
containers:
- name: node-web-app
# image must be the same as you built before (name:tag)
image: banuka/node-web-app
ports:
- name: http
containerPort: 8080
protocol: TCP
imagePullPolicy: Never
terminationGracePeriodSeconds: 60
如何向外界公开运行nodejs
服务器的部署?
你通常不能。仅为主机设置网络。不过,您可能可以使用ngrok或其他东西?
您可以使用ngrok
.例如
ngrok http 8000
这将生成可轻视的网址。