获得节点Inspector。
我正在Mac上运行Minikube,以在本地开发/测试我的微服务。
是否可以通过节点检查员在Minikube中调试我的nodejs(也欢迎其他工具)?
我看到有一个选择使用docker-compose的节点检查员的选项,但是由于我在> k8s 中运行所有服务,因此我选择Minikube。
说您有此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