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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현