我正在我的mac上运行minikube,以便在本地开发/测试我的微型服务。
是否可以通过节点检查器(也欢迎其他工具)在minikube中调试我的NodeJS?
我看到有一个选项可以使用节点检查器使用坞-撰写,但是由于我在k8s中运行我的所有服务,所以我选择Minikube。
发布于 2016-12-15 07:27:50
假设您有这个npm脚本:
"dev": "concurrently -p \"[{name}]\" -n \"NODE INSPECTOR,NODEMON\" -c \"bgBlue.bold,bgGreen.bold\" \"node-inspector --web-port=8081 --debug-port=5860 --preload\" \"cross-env NODE_ENV=development nodemon ./node_modules/babel-cli/bin/babel-node.js --max-old-space-size=512 --debug=5860 ./index.js\""节点-检查器不在8081端口上运行。
现在,在您的kubernetes.yml中,您可以有以下内容:
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: helloworld
name: helloworld
namespace: application
spec:
replicas: 1
selector:
matchLabels:
app: helloworld
template:
metadata:
labels:
app: helloworld
spec:
containers:
- name: helloworld
imagePullPolicy: Always
image: fbgrecojr/hello-world:latest
ports:
- containerPort: 8080
protocol: TCP
- containerPort: 8081
protocol: TCP
---
kind: Service
apiVersion: v1
metadata:
labels:
app: helloworld
name: helloworld
namespace: application
spec:
type: NodePort
ports:
- port: 8080
protocol: TCP
nodePort: 30000
- port: 8081
protocol: TCP
nodePort: 30001
selector:
app: helloworld您的应用程序无法从$(minikube ip):30000访问,节点检查器可从$(minikube ip):30000访问。
https://stackoverflow.com/questions/41108253
复制相似问题