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;
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
|
show 2 more comments
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
1
Hi, if the communication is internal among the services then value should betype: ClusterIPthantype: 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 runkubectl describe service dgserviceandkubectl get endpoints dgservice
– Suresh Vishnoi
Mar 27 at 9:00
|
show 2 more comments
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
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
docker
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: ClusterIPthantype: 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 runkubectl describe service dgserviceandkubectl get endpoints dgservice
– Suresh Vishnoi
Mar 27 at 9:00
|
show 2 more comments
1
Hi, if the communication is internal among the services then value should betype: ClusterIPthantype: 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 runkubectl describe service dgserviceandkubectl get endpoints dgservice
– Suresh Vishnoi
Mar 27 at 9:00
1
1
Hi, if the communication is internal among the services then value should be
type: ClusterIP than type: NodePort– Suresh Vishnoi
Mar 26 at 12:04
Hi, if the communication is internal among the services then value should be
type: 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
|
show 2 more comments
2 Answers
2
active
oldest
votes
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
add a comment |
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.
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
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
add a comment |
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
answered Mar 26 at 20:01
Frank Yucheng GuFrank Yucheng Gu
1,11513 bronze badges
1,11513 bronze badges
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
Hi, if the communication is internal among the services then value should be
type: ClusterIPthantype: 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 dgserviceandkubectl get endpoints dgservice– Suresh Vishnoi
Mar 27 at 9:00