Different behavior when accessing app through NodePort and from inside Pod











up vote
0
down vote

favorite












This is my firstpod service.yml file .



apiVersion: v1
kind: Service
metadata:
name: firstpod
spec:
ports:
- port: 2025
targetPort: 2025
nodePort: 30384
name: http
selector:
app: firstpod
type: NodePort


and firstpod deployment.yml file is ,



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


After deployment while acessing using nodeport port ,



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


I am able to see the the details . But while accessing from pod ,



kubectl exec -it firstpod /bin/sh


Then,



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


I am getting error ,the logs it shows that ,appuserid always passed as null .
If I am changing the parameter to



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


Then able to see the details .



Any idea why I am getting null values of appuserid always in first curl command ?










share|improve this question




























    up vote
    0
    down vote

    favorite












    This is my firstpod service.yml file .



    apiVersion: v1
    kind: Service
    metadata:
    name: firstpod
    spec:
    ports:
    - port: 2025
    targetPort: 2025
    nodePort: 30384
    name: http
    selector:
    app: firstpod
    type: NodePort


    and firstpod deployment.yml file is ,



    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


    After deployment while acessing using nodeport port ,



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


    I am able to see the the details . But while accessing from pod ,



    kubectl exec -it firstpod /bin/sh


    Then,



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


    I am getting error ,the logs it shows that ,appuserid always passed as null .
    If I am changing the parameter to



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


    Then able to see the details .



    Any idea why I am getting null values of appuserid always in first curl command ?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      This is my firstpod service.yml file .



      apiVersion: v1
      kind: Service
      metadata:
      name: firstpod
      spec:
      ports:
      - port: 2025
      targetPort: 2025
      nodePort: 30384
      name: http
      selector:
      app: firstpod
      type: NodePort


      and firstpod deployment.yml file is ,



      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


      After deployment while acessing using nodeport port ,



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


      I am able to see the the details . But while accessing from pod ,



      kubectl exec -it firstpod /bin/sh


      Then,



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


      I am getting error ,the logs it shows that ,appuserid always passed as null .
      If I am changing the parameter to



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


      Then able to see the details .



      Any idea why I am getting null values of appuserid always in first curl command ?










      share|improve this question















      This is my firstpod service.yml file .



      apiVersion: v1
      kind: Service
      metadata:
      name: firstpod
      spec:
      ports:
      - port: 2025
      targetPort: 2025
      nodePort: 30384
      name: http
      selector:
      app: firstpod
      type: NodePort


      and firstpod deployment.yml file is ,



      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


      After deployment while acessing using nodeport port ,



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


      I am able to see the the details . But while accessing from pod ,



      kubectl exec -it firstpod /bin/sh


      Then,



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


      I am getting error ,the logs it shows that ,appuserid always passed as null .
      If I am changing the parameter to



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


      Then able to see the details .



      Any idea why I am getting null values of appuserid always in first curl command ?







      curl kubernetes azure-devops-rest-api kubernetes-service






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited yesterday









      Emruz Hossain

      84217




      84217










      asked yesterday









      Chintamani

      2421724




      2421724





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370657%2fdifferent-behavior-when-accessing-app-through-nodeport-and-from-inside-pod%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370657%2fdifferent-behavior-when-accessing-app-through-nodeport-and-from-inside-pod%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

          ts Property 'filter' does not exist on type '{}'

          mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window