Access pod localhost from Servicerequests.get(url) return error code 404 from kubernetes api while the response could be get via curl/GETWhat's the difference between ClusterIP, NodePort and LoadBalancer service types in Kubernetes?Kubernetes Pod fails with CrashLoopBackOffKubernetes Cluster on AWS with Kops - NodePort Service UnavailableGKE with Ingress setup always gives status UNHEALTHYkubernetes cluster mode, what is ingress url?Why Kubernetes config file for ThingsBoard service use TCP for CoAP?AKS(kubernetes) service with UDP and TCPKubeadm join fail. Is my master cluster IP 192.168.0.9 or 10.96.0.1?Alternative solution for host port networking that allows running multiple pods in Kubernetes

Nails holding drywall

Is there any pythonic way to find average of specific tuple elements in array?

Can a stored procedure reference the database in which it is stored?

Older movie/show about humans on derelict alien warship which refuels by passing through a star

Why doesn't the standard consider a template constructor as a copy constructor?

How much of a wave function must reside inside event horizon for it to be consumed by the black hole?

Why do games have consumables?

How to not starve gigantic beasts

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

What is this word supposed to be?

Was Dennis Ritchie being too modest in this quote about C and Pascal?

Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?

What does a straight horizontal line above a few notes, after a changed tempo mean?

Contradiction proof for inequality of P and NP?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

Why do distances seem to matter in the Foundation world?

How do I produce this symbol: Ϟ in pdfLaTeX?

Why is the underscore command _ useful?

Magical attacks and overcoming damage resistance

What makes accurate emulation of old systems a difficult task?

NPN: Not fully sinking to GND

Can I criticise the more senior developers around me for not writing clean code?

Work requires me to come in early to start computer but wont let me clock in to get paid for it

Which big number is bigger?



Access pod localhost from Service


requests.get(url) return error code 404 from kubernetes api while the response could be get via curl/GETWhat's the difference between ClusterIP, NodePort and LoadBalancer service types in Kubernetes?Kubernetes Pod fails with CrashLoopBackOffKubernetes Cluster on AWS with Kops - NodePort Service UnavailableGKE with Ingress setup always gives status UNHEALTHYkubernetes cluster mode, what is ingress url?Why Kubernetes config file for ThingsBoard service use TCP for CoAP?AKS(kubernetes) service with UDP and TCPKubeadm join fail. Is my master cluster IP 192.168.0.9 or 10.96.0.1?Alternative solution for host port networking that allows running multiple pods in Kubernetes






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















New to Kubernetes.



I have a private dockerhub image deployed on a Kubernetes instance. When I exec into the pod I can run the following so I know my docker image is running:



root@private-reg:/# curl 127.0.0.1:8085
Hello world!root@private-reg:/#


From the dashboard I can see my service has an external endpoint which ends with port 8085. When I try to load this I get 404. My service YAML is as below:




"kind": "Service",
"apiVersion": "v1",
"metadata":
"name": "test",
"namespace": "default",
"selfLink": "/api/v1/namespaces/default/services/test",
"uid": "a1a2ae23-339b-11e9-a3db-ae0f8069b739",
"resourceVersion": "3297377",
"creationTimestamp": "2019-02-18T16:38:33Z",
"labels":
"k8s-app": "test"

,
"spec":
"ports": [

"name": "tcp-8085-8085-7vzsb",
"protocol": "TCP",
"port": 8085,
"targetPort": 8085,
"nodePort": 31859

],
"selector":
"k8s-app": "test"
,
"clusterIP": "******",
"type": "LoadBalancer",
"sessionAffinity": "None",
"externalTrafficPolicy": "Cluster"
,
"status":
"loadBalancer":
"ingress": [

"ip": "******"

]





Can anyone point me in the right direction.










share|improve this question






























    1















    New to Kubernetes.



    I have a private dockerhub image deployed on a Kubernetes instance. When I exec into the pod I can run the following so I know my docker image is running:



    root@private-reg:/# curl 127.0.0.1:8085
    Hello world!root@private-reg:/#


    From the dashboard I can see my service has an external endpoint which ends with port 8085. When I try to load this I get 404. My service YAML is as below:




    "kind": "Service",
    "apiVersion": "v1",
    "metadata":
    "name": "test",
    "namespace": "default",
    "selfLink": "/api/v1/namespaces/default/services/test",
    "uid": "a1a2ae23-339b-11e9-a3db-ae0f8069b739",
    "resourceVersion": "3297377",
    "creationTimestamp": "2019-02-18T16:38:33Z",
    "labels":
    "k8s-app": "test"

    ,
    "spec":
    "ports": [

    "name": "tcp-8085-8085-7vzsb",
    "protocol": "TCP",
    "port": 8085,
    "targetPort": 8085,
    "nodePort": 31859

    ],
    "selector":
    "k8s-app": "test"
    ,
    "clusterIP": "******",
    "type": "LoadBalancer",
    "sessionAffinity": "None",
    "externalTrafficPolicy": "Cluster"
    ,
    "status":
    "loadBalancer":
    "ingress": [

    "ip": "******"

    ]





    Can anyone point me in the right direction.










    share|improve this question


























      1












      1








      1








      New to Kubernetes.



      I have a private dockerhub image deployed on a Kubernetes instance. When I exec into the pod I can run the following so I know my docker image is running:



      root@private-reg:/# curl 127.0.0.1:8085
      Hello world!root@private-reg:/#


      From the dashboard I can see my service has an external endpoint which ends with port 8085. When I try to load this I get 404. My service YAML is as below:




      "kind": "Service",
      "apiVersion": "v1",
      "metadata":
      "name": "test",
      "namespace": "default",
      "selfLink": "/api/v1/namespaces/default/services/test",
      "uid": "a1a2ae23-339b-11e9-a3db-ae0f8069b739",
      "resourceVersion": "3297377",
      "creationTimestamp": "2019-02-18T16:38:33Z",
      "labels":
      "k8s-app": "test"

      ,
      "spec":
      "ports": [

      "name": "tcp-8085-8085-7vzsb",
      "protocol": "TCP",
      "port": 8085,
      "targetPort": 8085,
      "nodePort": 31859

      ],
      "selector":
      "k8s-app": "test"
      ,
      "clusterIP": "******",
      "type": "LoadBalancer",
      "sessionAffinity": "None",
      "externalTrafficPolicy": "Cluster"
      ,
      "status":
      "loadBalancer":
      "ingress": [

      "ip": "******"

      ]





      Can anyone point me in the right direction.










      share|improve this question
















      New to Kubernetes.



      I have a private dockerhub image deployed on a Kubernetes instance. When I exec into the pod I can run the following so I know my docker image is running:



      root@private-reg:/# curl 127.0.0.1:8085
      Hello world!root@private-reg:/#


      From the dashboard I can see my service has an external endpoint which ends with port 8085. When I try to load this I get 404. My service YAML is as below:




      "kind": "Service",
      "apiVersion": "v1",
      "metadata":
      "name": "test",
      "namespace": "default",
      "selfLink": "/api/v1/namespaces/default/services/test",
      "uid": "a1a2ae23-339b-11e9-a3db-ae0f8069b739",
      "resourceVersion": "3297377",
      "creationTimestamp": "2019-02-18T16:38:33Z",
      "labels":
      "k8s-app": "test"

      ,
      "spec":
      "ports": [

      "name": "tcp-8085-8085-7vzsb",
      "protocol": "TCP",
      "port": 8085,
      "targetPort": 8085,
      "nodePort": 31859

      ],
      "selector":
      "k8s-app": "test"
      ,
      "clusterIP": "******",
      "type": "LoadBalancer",
      "sessionAffinity": "None",
      "externalTrafficPolicy": "Cluster"
      ,
      "status":
      "loadBalancer":
      "ingress": [

      "ip": "******"

      ]





      Can anyone point me in the right direction.







      kubernetes kubectl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 22 at 17:13







      Starchand

















      asked Mar 22 at 16:18









      StarchandStarchand

      402714




      402714






















          3 Answers
          3






          active

          oldest

          votes


















          1














          What is the output from the below command



          curl cluzterIP:8085



          If you get Hello world message then it means that the service is routing the traffic Correctly to the backend pod.



          curl HostIP:NODEPORT should also be working



          Most likely that service is not bound to the backend pod. Did you define the below label on the pod?



          labels: 
          "k8s-app": "test"






          share|improve this answer

























          • Nope, these both timeout. Seems something is not correctly set up?

            – Starchand
            Mar 22 at 17:12






          • 1





            Check updated answer

            – P Ekambaram
            Mar 22 at 18:59











          • You legend!! :D

            – Starchand
            Mar 23 at 12:13


















          1














          You didn't mention what type of load balancer or cloud provider you are using but if your load balancer provisioned correctly which you should be able to see in your kube-controller-manager logs, then you should be able to access your service with what you see here:



          "status": {
          "loadBalancer":
          "ingress": [

          "ip": "******"

          ]



          Then you could check by running:



          $ curl <ip>:<whatever external port your lb is fronting>


          It's likely that this didn't provision if as described in other answers this works:



          $ curl <clusterIP for svc>:8085


          and



          $ curl <NodeIP>:31859 # NodePort





          share|improve this answer






























            0














            Give a check on services on kuberntes, there are a few types:



            https://kubernetes.io/docs/concepts/services-networking/service/



            ClusterIP: creates access to service only inside the cluster.



            NodePort: Access service through a given port on the nodes.



            LoadBalancer: service externally acessible through a LB.



            I am assuming you are running on GKE.



            What kind of service is it, the one launched?






            share|improve this answer























            • I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

              – Starchand
              Mar 22 at 16:59












            • Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

              – Leandro Donizetti Soares
              Mar 22 at 17:33











            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',
            autoActivateHeartbeat: false,
            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%2f55303827%2faccess-pod-localhost-from-service%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            What is the output from the below command



            curl cluzterIP:8085



            If you get Hello world message then it means that the service is routing the traffic Correctly to the backend pod.



            curl HostIP:NODEPORT should also be working



            Most likely that service is not bound to the backend pod. Did you define the below label on the pod?



            labels: 
            "k8s-app": "test"






            share|improve this answer

























            • Nope, these both timeout. Seems something is not correctly set up?

              – Starchand
              Mar 22 at 17:12






            • 1





              Check updated answer

              – P Ekambaram
              Mar 22 at 18:59











            • You legend!! :D

              – Starchand
              Mar 23 at 12:13















            1














            What is the output from the below command



            curl cluzterIP:8085



            If you get Hello world message then it means that the service is routing the traffic Correctly to the backend pod.



            curl HostIP:NODEPORT should also be working



            Most likely that service is not bound to the backend pod. Did you define the below label on the pod?



            labels: 
            "k8s-app": "test"






            share|improve this answer

























            • Nope, these both timeout. Seems something is not correctly set up?

              – Starchand
              Mar 22 at 17:12






            • 1





              Check updated answer

              – P Ekambaram
              Mar 22 at 18:59











            • You legend!! :D

              – Starchand
              Mar 23 at 12:13













            1












            1








            1







            What is the output from the below command



            curl cluzterIP:8085



            If you get Hello world message then it means that the service is routing the traffic Correctly to the backend pod.



            curl HostIP:NODEPORT should also be working



            Most likely that service is not bound to the backend pod. Did you define the below label on the pod?



            labels: 
            "k8s-app": "test"






            share|improve this answer















            What is the output from the below command



            curl cluzterIP:8085



            If you get Hello world message then it means that the service is routing the traffic Correctly to the backend pod.



            curl HostIP:NODEPORT should also be working



            Most likely that service is not bound to the backend pod. Did you define the below label on the pod?



            labels: 
            "k8s-app": "test"







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 22 at 19:02

























            answered Mar 22 at 17:06









            P EkambaramP Ekambaram

            1,807723




            1,807723












            • Nope, these both timeout. Seems something is not correctly set up?

              – Starchand
              Mar 22 at 17:12






            • 1





              Check updated answer

              – P Ekambaram
              Mar 22 at 18:59











            • You legend!! :D

              – Starchand
              Mar 23 at 12:13

















            • Nope, these both timeout. Seems something is not correctly set up?

              – Starchand
              Mar 22 at 17:12






            • 1





              Check updated answer

              – P Ekambaram
              Mar 22 at 18:59











            • You legend!! :D

              – Starchand
              Mar 23 at 12:13
















            Nope, these both timeout. Seems something is not correctly set up?

            – Starchand
            Mar 22 at 17:12





            Nope, these both timeout. Seems something is not correctly set up?

            – Starchand
            Mar 22 at 17:12




            1




            1





            Check updated answer

            – P Ekambaram
            Mar 22 at 18:59





            Check updated answer

            – P Ekambaram
            Mar 22 at 18:59













            You legend!! :D

            – Starchand
            Mar 23 at 12:13





            You legend!! :D

            – Starchand
            Mar 23 at 12:13













            1














            You didn't mention what type of load balancer or cloud provider you are using but if your load balancer provisioned correctly which you should be able to see in your kube-controller-manager logs, then you should be able to access your service with what you see here:



            "status": {
            "loadBalancer":
            "ingress": [

            "ip": "******"

            ]



            Then you could check by running:



            $ curl <ip>:<whatever external port your lb is fronting>


            It's likely that this didn't provision if as described in other answers this works:



            $ curl <clusterIP for svc>:8085


            and



            $ curl <NodeIP>:31859 # NodePort





            share|improve this answer



























              1














              You didn't mention what type of load balancer or cloud provider you are using but if your load balancer provisioned correctly which you should be able to see in your kube-controller-manager logs, then you should be able to access your service with what you see here:



              "status": {
              "loadBalancer":
              "ingress": [

              "ip": "******"

              ]



              Then you could check by running:



              $ curl <ip>:<whatever external port your lb is fronting>


              It's likely that this didn't provision if as described in other answers this works:



              $ curl <clusterIP for svc>:8085


              and



              $ curl <NodeIP>:31859 # NodePort





              share|improve this answer

























                1












                1








                1







                You didn't mention what type of load balancer or cloud provider you are using but if your load balancer provisioned correctly which you should be able to see in your kube-controller-manager logs, then you should be able to access your service with what you see here:



                "status": {
                "loadBalancer":
                "ingress": [

                "ip": "******"

                ]



                Then you could check by running:



                $ curl <ip>:<whatever external port your lb is fronting>


                It's likely that this didn't provision if as described in other answers this works:



                $ curl <clusterIP for svc>:8085


                and



                $ curl <NodeIP>:31859 # NodePort





                share|improve this answer













                You didn't mention what type of load balancer or cloud provider you are using but if your load balancer provisioned correctly which you should be able to see in your kube-controller-manager logs, then you should be able to access your service with what you see here:



                "status": {
                "loadBalancer":
                "ingress": [

                "ip": "******"

                ]



                Then you could check by running:



                $ curl <ip>:<whatever external port your lb is fronting>


                It's likely that this didn't provision if as described in other answers this works:



                $ curl <clusterIP for svc>:8085


                and



                $ curl <NodeIP>:31859 # NodePort






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 at 17:33









                RicoRico

                30.1k105573




                30.1k105573





















                    0














                    Give a check on services on kuberntes, there are a few types:



                    https://kubernetes.io/docs/concepts/services-networking/service/



                    ClusterIP: creates access to service only inside the cluster.



                    NodePort: Access service through a given port on the nodes.



                    LoadBalancer: service externally acessible through a LB.



                    I am assuming you are running on GKE.



                    What kind of service is it, the one launched?






                    share|improve this answer























                    • I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

                      – Starchand
                      Mar 22 at 16:59












                    • Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

                      – Leandro Donizetti Soares
                      Mar 22 at 17:33















                    0














                    Give a check on services on kuberntes, there are a few types:



                    https://kubernetes.io/docs/concepts/services-networking/service/



                    ClusterIP: creates access to service only inside the cluster.



                    NodePort: Access service through a given port on the nodes.



                    LoadBalancer: service externally acessible through a LB.



                    I am assuming you are running on GKE.



                    What kind of service is it, the one launched?






                    share|improve this answer























                    • I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

                      – Starchand
                      Mar 22 at 16:59












                    • Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

                      – Leandro Donizetti Soares
                      Mar 22 at 17:33













                    0












                    0








                    0







                    Give a check on services on kuberntes, there are a few types:



                    https://kubernetes.io/docs/concepts/services-networking/service/



                    ClusterIP: creates access to service only inside the cluster.



                    NodePort: Access service through a given port on the nodes.



                    LoadBalancer: service externally acessible through a LB.



                    I am assuming you are running on GKE.



                    What kind of service is it, the one launched?






                    share|improve this answer













                    Give a check on services on kuberntes, there are a few types:



                    https://kubernetes.io/docs/concepts/services-networking/service/



                    ClusterIP: creates access to service only inside the cluster.



                    NodePort: Access service through a given port on the nodes.



                    LoadBalancer: service externally acessible through a LB.



                    I am assuming you are running on GKE.



                    What kind of service is it, the one launched?







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Mar 22 at 16:33









                    Leandro Donizetti SoaresLeandro Donizetti Soares

                    20617




                    20617












                    • I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

                      – Starchand
                      Mar 22 at 16:59












                    • Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

                      – Leandro Donizetti Soares
                      Mar 22 at 17:33

















                    • I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

                      – Starchand
                      Mar 22 at 16:59












                    • Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

                      – Leandro Donizetti Soares
                      Mar 22 at 17:33
















                    I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

                    – Starchand
                    Mar 22 at 16:59






                    I'm using Azure, but everything is managed by the main Kubernetes dashboard. Believe I'm using LoadBalancer - have added my service YAML to original question.

                    – Starchand
                    Mar 22 at 16:59














                    Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

                    – Leandro Donizetti Soares
                    Mar 22 at 17:33





                    Do you have access to CLI on k8s, are you able to use kubectl command? if so, use kubectl get services, use it and get the external ip to access the service, you can cehck if the service is really load balancing.

                    – Leandro Donizetti Soares
                    Mar 22 at 17:33

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55303827%2faccess-pod-localhost-from-service%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript