Connection issue between services in kubernetesWhat is the difference between CMD and ENTRYPOINT in a Dockerfile?What is the difference between the `COPY` and `ADD` commands in a Dockerfile?Kubernetes equivalent of env-file in DockerDocker link container as build argumentKubectl apply for a deployment with revHistoryLimit 0 does not delete the old replica set, here is my deploment templateHow to mount a volume with a windows container in kubernetes?Share nfs volume between kubernetes clustersAccess stateful headless kubernetes externally?kubernetes deployment with argskubernetes springboot app connect to external database is fail

What does Windows' "Tuning up Application Start" do?

Why is there an extra "t" in Lemmatization?

Host telling me to cancel my booking in exchange for a discount?

"This used to be my phone number"

Is it ethical to tell my teaching assistant that I like them?

Can a creature sustain itself by eating its own severed body parts?

Do I care if the housing market has gone up or down, if I'm moving from one house to another?

What's the physical meaning of the statement that "photons don't have positions"?

How to get all the sub-rectangles (subgeohashes) of a given geohash

Difference between string += s1 and string=string +s1

Conditional statement in a function for PS1 are not re-evalutated

Could a US citizen born through "birth tourism" become President?

Why does a tetrahedral molecule like methane have a dipole moment of zero?

Could Europeans in Europe demand protection under UN Declaration on the Rights of Indigenous Peoples?

How to declare an array without specifying its size, but with an initializer inside a class in C++?

Is it possible to have a career in SciComp without contributing to arms research?

Longtable of size textwidth exceeds right margin

Last-minute canceled work-trip means I'll lose thousands of dollars on planned vacation

What would be an ideal fidelity measure to determine the closeness between two non unitary matrices?

Do pedestrians imitate automotive traffic?

Counting multiples of 3 up to a given number

How does the Gameboy's memory bank switching work?

Time war story - soldier name lengthens as he travels further from the battle front

Satellite in orbit in front of and behind the Moon



Connection issue between services in kubernetes


What is the difference between CMD and ENTRYPOINT in a Dockerfile?What is the difference between the `COPY` and `ADD` commands in a Dockerfile?Kubernetes equivalent of env-file in DockerDocker link container as build argumentKubectl apply for a deployment with revHistoryLimit 0 does not delete the old replica set, here is my deploment templateHow to mount a volume with a windows container in kubernetes?Share nfs volume between kubernetes clustersAccess stateful headless kubernetes externally?kubernetes deployment with argskubernetes springboot app connect to external database is fail






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have three different images related to my application which works fine in docker-compose and has issues running on kubernetes cluster in GCP.



Below is the deployment file.



apiVersion: v1
kind: Service
metadata:
name: mysql
labels:
app: mysql-database
spec:
type: NodePort
ports:
- port: 3306
targetPort: 3306
selector:
app: mysql-database
tier: database
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mysql
labels:
app: mysql-database
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql-database
tier: database
spec:
hostname: mysql
containers:
- image: mysql/mysql-server:5.7
name: mysql
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
ports:
- containerPort: 5432
name: db
---
apiVersion: v1
kind: Service
metadata:
name: dgservice
labels:
app: dgservice
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
name: dgservice
tier: dgservice
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dgservice
labels:
app: dgservice
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dgservice
tier: dgservice
spec:
hostname: dgservice
containers:
- image: gcr.io/sample/sample-image:check_1
name: dgservice
ports:
- containerPort: 8080
name: dgservice
---
apiVersion: v1
kind: Service
metadata:
name: dg-ui
labels:
name: dg-ui
spec:
type: NodePort
ports:
- nodePort: 30156
port: 8000
protocol: TCP
targetPort: 8000
selector:
app: dg-ui
tier: dg
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dg-ui
labels:
app: dg-ui
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dg-ui
tier: dg
spec:
hostname: dg-ui
containers:
- image: gcr.io/sample/sample:latest
name: dg-ui
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
- name: "DG_SERVICE_HOST"
value: "dgservice"
ports:
- containerPort: 8000
name: dg-ui


The image is being pulled successfully from GCR as well.



The connection between mysql and ui service also works fine and my data's are getting migrated without any issues. But the connection is not established between the service and the ui.



Why ui is not able to access service in my application?










share|improve this question

















  • 1





    Hi, if the communication is internal among the services then value should betype: ClusterIP than type: NodePort

    – Suresh Vishnoi
    Mar 26 at 12:04











  • What error are you having? are you able to curl to the services ?

    – Suresh Vishnoi
    Mar 26 at 12:07











  • @SureshVishnoi curl is not working fine. kubectl exec -it dg-ui-586c69fdb8-8wvdn bash root@dg-ui:/home/app/webapp# curl http://dgservice:8080/fieldTypes/metadata curl: (7) Failed to connect to dgservice port 8080: Connection timed out root@dg-ui:/home/app/webapp# command terminated with exit code 137. But the same curl is working fine when I run it from dgservice node

    – klee
    Mar 27 at 8:49












  • @SureshVishnoi I've tried with ClusterIP as well. still it is not working

    – klee
    Mar 27 at 8:53











  • Hi, Can you run kubectl describe service dgservice and kubectl get endpoints dgservice

    – Suresh Vishnoi
    Mar 27 at 9:00


















0















I have three different images related to my application which works fine in docker-compose and has issues running on kubernetes cluster in GCP.



Below is the deployment file.



apiVersion: v1
kind: Service
metadata:
name: mysql
labels:
app: mysql-database
spec:
type: NodePort
ports:
- port: 3306
targetPort: 3306
selector:
app: mysql-database
tier: database
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mysql
labels:
app: mysql-database
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql-database
tier: database
spec:
hostname: mysql
containers:
- image: mysql/mysql-server:5.7
name: mysql
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
ports:
- containerPort: 5432
name: db
---
apiVersion: v1
kind: Service
metadata:
name: dgservice
labels:
app: dgservice
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
name: dgservice
tier: dgservice
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dgservice
labels:
app: dgservice
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dgservice
tier: dgservice
spec:
hostname: dgservice
containers:
- image: gcr.io/sample/sample-image:check_1
name: dgservice
ports:
- containerPort: 8080
name: dgservice
---
apiVersion: v1
kind: Service
metadata:
name: dg-ui
labels:
name: dg-ui
spec:
type: NodePort
ports:
- nodePort: 30156
port: 8000
protocol: TCP
targetPort: 8000
selector:
app: dg-ui
tier: dg
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dg-ui
labels:
app: dg-ui
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dg-ui
tier: dg
spec:
hostname: dg-ui
containers:
- image: gcr.io/sample/sample:latest
name: dg-ui
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
- name: "DG_SERVICE_HOST"
value: "dgservice"
ports:
- containerPort: 8000
name: dg-ui


The image is being pulled successfully from GCR as well.



The connection between mysql and ui service also works fine and my data's are getting migrated without any issues. But the connection is not established between the service and the ui.



Why ui is not able to access service in my application?










share|improve this question

















  • 1





    Hi, if the communication is internal among the services then value should betype: ClusterIP than type: NodePort

    – Suresh Vishnoi
    Mar 26 at 12:04











  • What error are you having? are you able to curl to the services ?

    – Suresh Vishnoi
    Mar 26 at 12:07











  • @SureshVishnoi curl is not working fine. kubectl exec -it dg-ui-586c69fdb8-8wvdn bash root@dg-ui:/home/app/webapp# curl http://dgservice:8080/fieldTypes/metadata curl: (7) Failed to connect to dgservice port 8080: Connection timed out root@dg-ui:/home/app/webapp# command terminated with exit code 137. But the same curl is working fine when I run it from dgservice node

    – klee
    Mar 27 at 8:49












  • @SureshVishnoi I've tried with ClusterIP as well. still it is not working

    – klee
    Mar 27 at 8:53











  • Hi, Can you run kubectl describe service dgservice and kubectl get endpoints dgservice

    – Suresh Vishnoi
    Mar 27 at 9:00














0












0








0








I have three different images related to my application which works fine in docker-compose and has issues running on kubernetes cluster in GCP.



Below is the deployment file.



apiVersion: v1
kind: Service
metadata:
name: mysql
labels:
app: mysql-database
spec:
type: NodePort
ports:
- port: 3306
targetPort: 3306
selector:
app: mysql-database
tier: database
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mysql
labels:
app: mysql-database
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql-database
tier: database
spec:
hostname: mysql
containers:
- image: mysql/mysql-server:5.7
name: mysql
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
ports:
- containerPort: 5432
name: db
---
apiVersion: v1
kind: Service
metadata:
name: dgservice
labels:
app: dgservice
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
name: dgservice
tier: dgservice
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dgservice
labels:
app: dgservice
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dgservice
tier: dgservice
spec:
hostname: dgservice
containers:
- image: gcr.io/sample/sample-image:check_1
name: dgservice
ports:
- containerPort: 8080
name: dgservice
---
apiVersion: v1
kind: Service
metadata:
name: dg-ui
labels:
name: dg-ui
spec:
type: NodePort
ports:
- nodePort: 30156
port: 8000
protocol: TCP
targetPort: 8000
selector:
app: dg-ui
tier: dg
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dg-ui
labels:
app: dg-ui
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dg-ui
tier: dg
spec:
hostname: dg-ui
containers:
- image: gcr.io/sample/sample:latest
name: dg-ui
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
- name: "DG_SERVICE_HOST"
value: "dgservice"
ports:
- containerPort: 8000
name: dg-ui


The image is being pulled successfully from GCR as well.



The connection between mysql and ui service also works fine and my data's are getting migrated without any issues. But the connection is not established between the service and the ui.



Why ui is not able to access service in my application?










share|improve this question














I have three different images related to my application which works fine in docker-compose and has issues running on kubernetes cluster in GCP.



Below is the deployment file.



apiVersion: v1
kind: Service
metadata:
name: mysql
labels:
app: mysql-database
spec:
type: NodePort
ports:
- port: 3306
targetPort: 3306
selector:
app: mysql-database
tier: database
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: mysql
labels:
app: mysql-database
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql-database
tier: database
spec:
hostname: mysql
containers:
- image: mysql/mysql-server:5.7
name: mysql
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
ports:
- containerPort: 5432
name: db
---
apiVersion: v1
kind: Service
metadata:
name: dgservice
labels:
app: dgservice
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
name: dgservice
tier: dgservice
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dgservice
labels:
app: dgservice
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dgservice
tier: dgservice
spec:
hostname: dgservice
containers:
- image: gcr.io/sample/sample-image:check_1
name: dgservice
ports:
- containerPort: 8080
name: dgservice
---
apiVersion: v1
kind: Service
metadata:
name: dg-ui
labels:
name: dg-ui
spec:
type: NodePort
ports:
- nodePort: 30156
port: 8000
protocol: TCP
targetPort: 8000
selector:
app: dg-ui
tier: dg
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: dg-ui
labels:
app: dg-ui
spec:
strategy:
type: Recreate
template:
metadata:
labels:
app: dg-ui
tier: dg
spec:
hostname: dg-ui
containers:
- image: gcr.io/sample/sample:latest
name: dg-ui
env:
- name: "MYSQL_USER"
value: "root"
- name: "MYSQL_HOST"
value: "mysql"
- name: "MYSQL_DATABASE"
value: "xxxx"
- name: "MYSQL_PORT"
value: "3306"
- name: "MYSQL_PASSWORD"
value: "password"
- name: "MYSQL_ROOT_PASSWORD"
value: "password"
- name: "RAILS_ENV"
value: "production"
- name: "DG_SERVICE_HOST"
value: "dgservice"
ports:
- containerPort: 8000
name: dg-ui


The image is being pulled successfully from GCR as well.



The connection between mysql and ui service also works fine and my data's are getting migrated without any issues. But the connection is not established between the service and the ui.



Why ui is not able to access service in my application?







docker kubernetes google-kubernetes-engine






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 12:02









kleeklee

1141 gold badge1 silver badge14 bronze badges




1141 gold badge1 silver badge14 bronze badges







  • 1





    Hi, if the communication is internal among the services then value should betype: ClusterIP than type: NodePort

    – Suresh Vishnoi
    Mar 26 at 12:04











  • What error are you having? are you able to curl to the services ?

    – Suresh Vishnoi
    Mar 26 at 12:07











  • @SureshVishnoi curl is not working fine. kubectl exec -it dg-ui-586c69fdb8-8wvdn bash root@dg-ui:/home/app/webapp# curl http://dgservice:8080/fieldTypes/metadata curl: (7) Failed to connect to dgservice port 8080: Connection timed out root@dg-ui:/home/app/webapp# command terminated with exit code 137. But the same curl is working fine when I run it from dgservice node

    – klee
    Mar 27 at 8:49












  • @SureshVishnoi I've tried with ClusterIP as well. still it is not working

    – klee
    Mar 27 at 8:53











  • Hi, Can you run kubectl describe service dgservice and kubectl get endpoints dgservice

    – Suresh Vishnoi
    Mar 27 at 9:00













  • 1





    Hi, if the communication is internal among the services then value should betype: ClusterIP than type: NodePort

    – Suresh Vishnoi
    Mar 26 at 12:04











  • What error are you having? are you able to curl to the services ?

    – Suresh Vishnoi
    Mar 26 at 12:07











  • @SureshVishnoi curl is not working fine. kubectl exec -it dg-ui-586c69fdb8-8wvdn bash root@dg-ui:/home/app/webapp# curl http://dgservice:8080/fieldTypes/metadata curl: (7) Failed to connect to dgservice port 8080: Connection timed out root@dg-ui:/home/app/webapp# command terminated with exit code 137. But the same curl is working fine when I run it from dgservice node

    – klee
    Mar 27 at 8:49












  • @SureshVishnoi I've tried with ClusterIP as well. still it is not working

    – klee
    Mar 27 at 8:53











  • Hi, Can you run kubectl describe service dgservice and kubectl get endpoints dgservice

    – Suresh Vishnoi
    Mar 27 at 9:00








1




1





Hi, if the communication is internal among the services then value should betype: ClusterIP than type: NodePort

– Suresh Vishnoi
Mar 26 at 12:04





Hi, if the communication is internal among the services then value should betype: ClusterIP than type: NodePort

– Suresh Vishnoi
Mar 26 at 12:04













What error are you having? are you able to curl to the services ?

– Suresh Vishnoi
Mar 26 at 12:07





What error are you having? are you able to curl to the services ?

– Suresh Vishnoi
Mar 26 at 12:07













@SureshVishnoi curl is not working fine. kubectl exec -it dg-ui-586c69fdb8-8wvdn bash root@dg-ui:/home/app/webapp# curl http://dgservice:8080/fieldTypes/metadata curl: (7) Failed to connect to dgservice port 8080: Connection timed out root@dg-ui:/home/app/webapp# command terminated with exit code 137. But the same curl is working fine when I run it from dgservice node

– klee
Mar 27 at 8:49






@SureshVishnoi curl is not working fine. kubectl exec -it dg-ui-586c69fdb8-8wvdn bash root@dg-ui:/home/app/webapp# curl http://dgservice:8080/fieldTypes/metadata curl: (7) Failed to connect to dgservice port 8080: Connection timed out root@dg-ui:/home/app/webapp# command terminated with exit code 137. But the same curl is working fine when I run it from dgservice node

– klee
Mar 27 at 8:49














@SureshVishnoi I've tried with ClusterIP as well. still it is not working

– klee
Mar 27 at 8:53





@SureshVishnoi I've tried with ClusterIP as well. still it is not working

– klee
Mar 27 at 8:53













Hi, Can you run kubectl describe service dgservice and kubectl get endpoints dgservice

– Suresh Vishnoi
Mar 27 at 9:00






Hi, Can you run kubectl describe service dgservice and kubectl get endpoints dgservice

– Suresh Vishnoi
Mar 27 at 9:00













2 Answers
2






active

oldest

votes


















2














As your deployment has the following lables so service need to have same labels in order to create endpoint object



endpoints are the API object behind a service. The endpoints are where a service will route connections to when a connection is made to the ClusterIP of a service



Following are the labels of deployments



 labels:
app: dgservice
tier: dgservice


New Service definition with correct labels



apiVersion: v1
kind: Service
metadata:
name: dgservice
labels:
app: dgservice
spec:
type: NodePort
ports:
- port: 8080
targetPort: 8080
selector:
app: dgservice
tier: dgservice





share|improve this answer






























    0














    I am assuming by "service" you are referring to your "dgservice". With the yaml presented above, I believe you also need to specify the DG_SERVICE_PORT (port 8080) to correctly access "dgservice".



    As mentioned by Suresh in the comments, you should expose internal services using ClusterIP type. The NodePort is a superset of ClusterIP, and will expose the service internally to your cluster at service-name:port, and externally at node-ip:nodeport, targeting your deployment/pod at targetport.






    share|improve this answer

























      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%2f55356694%2fconnection-issue-between-services-in-kubernetes%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2














      As your deployment has the following lables so service need to have same labels in order to create endpoint object



      endpoints are the API object behind a service. The endpoints are where a service will route connections to when a connection is made to the ClusterIP of a service



      Following are the labels of deployments



       labels:
      app: dgservice
      tier: dgservice


      New Service definition with correct labels



      apiVersion: v1
      kind: Service
      metadata:
      name: dgservice
      labels:
      app: dgservice
      spec:
      type: NodePort
      ports:
      - port: 8080
      targetPort: 8080
      selector:
      app: dgservice
      tier: dgservice





      share|improve this answer



























        2














        As your deployment has the following lables so service need to have same labels in order to create endpoint object



        endpoints are the API object behind a service. The endpoints are where a service will route connections to when a connection is made to the ClusterIP of a service



        Following are the labels of deployments



         labels:
        app: dgservice
        tier: dgservice


        New Service definition with correct labels



        apiVersion: v1
        kind: Service
        metadata:
        name: dgservice
        labels:
        app: dgservice
        spec:
        type: NodePort
        ports:
        - port: 8080
        targetPort: 8080
        selector:
        app: dgservice
        tier: dgservice





        share|improve this answer

























          2












          2








          2







          As your deployment has the following lables so service need to have same labels in order to create endpoint object



          endpoints are the API object behind a service. The endpoints are where a service will route connections to when a connection is made to the ClusterIP of a service



          Following are the labels of deployments



           labels:
          app: dgservice
          tier: dgservice


          New Service definition with correct labels



          apiVersion: v1
          kind: Service
          metadata:
          name: dgservice
          labels:
          app: dgservice
          spec:
          type: NodePort
          ports:
          - port: 8080
          targetPort: 8080
          selector:
          app: dgservice
          tier: dgservice





          share|improve this answer













          As your deployment has the following lables so service need to have same labels in order to create endpoint object



          endpoints are the API object behind a service. The endpoints are where a service will route connections to when a connection is made to the ClusterIP of a service



          Following are the labels of deployments



           labels:
          app: dgservice
          tier: dgservice


          New Service definition with correct labels



          apiVersion: v1
          kind: Service
          metadata:
          name: dgservice
          labels:
          app: dgservice
          spec:
          type: NodePort
          ports:
          - port: 8080
          targetPort: 8080
          selector:
          app: dgservice
          tier: dgservice






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 27 at 12:05









          Suresh VishnoiSuresh Vishnoi

          4,8613 gold badges13 silver badges32 bronze badges




          4,8613 gold badges13 silver badges32 bronze badges























              0














              I am assuming by "service" you are referring to your "dgservice". With the yaml presented above, I believe you also need to specify the DG_SERVICE_PORT (port 8080) to correctly access "dgservice".



              As mentioned by Suresh in the comments, you should expose internal services using ClusterIP type. The NodePort is a superset of ClusterIP, and will expose the service internally to your cluster at service-name:port, and externally at node-ip:nodeport, targeting your deployment/pod at targetport.






              share|improve this answer



























                0














                I am assuming by "service" you are referring to your "dgservice". With the yaml presented above, I believe you also need to specify the DG_SERVICE_PORT (port 8080) to correctly access "dgservice".



                As mentioned by Suresh in the comments, you should expose internal services using ClusterIP type. The NodePort is a superset of ClusterIP, and will expose the service internally to your cluster at service-name:port, and externally at node-ip:nodeport, targeting your deployment/pod at targetport.






                share|improve this answer

























                  0












                  0








                  0







                  I am assuming by "service" you are referring to your "dgservice". With the yaml presented above, I believe you also need to specify the DG_SERVICE_PORT (port 8080) to correctly access "dgservice".



                  As mentioned by Suresh in the comments, you should expose internal services using ClusterIP type. The NodePort is a superset of ClusterIP, and will expose the service internally to your cluster at service-name:port, and externally at node-ip:nodeport, targeting your deployment/pod at targetport.






                  share|improve this answer













                  I am assuming by "service" you are referring to your "dgservice". With the yaml presented above, I believe you also need to specify the DG_SERVICE_PORT (port 8080) to correctly access "dgservice".



                  As mentioned by Suresh in the comments, you should expose internal services using ClusterIP type. The NodePort is a superset of ClusterIP, and will expose the service internally to your cluster at service-name:port, and externally at node-ip:nodeport, targeting your deployment/pod at targetport.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 26 at 20:01









                  Frank Yucheng GuFrank Yucheng Gu

                  1,11513 bronze badges




                  1,11513 bronze badges



























                      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%2f55356694%2fconnection-issue-between-services-in-kubernetes%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

                      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

                      용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                      155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해