这是我的第一脚架service.yml
文件。
apiVersion: v1
kind: Service
metadata:
name: firstpod
spec:
ports:
- port: 2025
targetPort: 2025
nodePort: 30384
name: http
selector:
app: firstpod
type: NodePort
并且firstpod deployment.yml
文件是
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: firstpod
spec:
selector:
matchLabels:
app: firstpod
replicas: 1 # tells deployment to run 3 pods matching the template
template: # create pods using pod definition in this template
metadata:
labels:
app: firstpod
spec:
containers:
- name: firstpod
image: firstpod
ports:
- containerPort: 2025
imagePullPolicy: Always
imagePullSecrets:
- name: regcred
在部署后使用nodeport端口访问时,
localhost:30384/firstpod/api/services/v1/notification/info/?statusid=1&appuserid=104
我可以看到详细信息。但是从pod进行访问时,
kubectl exec -it firstpod /bin/sh
然后
curl firstpod:2025/firstpod/api/services/v1/notification/info/?statusid=1&appuserid=104
我遇到错误,记录显示,appuserid始终传递为null。 如果我将参数更改为
curl firstpod:2025/dls/api/services/v1/notification/info/?appuserid=104 & statusid=1
然后可以查看详细信息。
有人知道为什么我总是在第一个curl命令中得到appuserid的空值吗?