Различное поведение при доступе к приложению через NodePort и из Pod - PullRequest
0 голосов
/ 19 ноября 2018

Это мой первый файл 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

После развертывания при доступе через порт нодпорта,

localhost:30384/firstpod/api/services/v1/notification/info/?statusid=1&appuserid=104

Я могу видеть детали. Но при доступе из стручка,

kubectl exec -it firstpod /bin/sh

Тогда

curl firstpod:2025/firstpod/api/services/v1/notification/info/?statusid=1&appuserid=104

Я получаю сообщение об ошибке, в журналах указано, что appuserid всегда принимается за ноль. Если я изменяю параметр на

curl firstpod:2025/dls/api/services/v1/notification/info/?appuserid=104 & statusid=1

Затем можно увидеть детали.

Есть идеи, почему я всегда получаю нулевые значения appuserid в первой команде curl?

...