Kubernetes pod can't access other pods exposed by a serviceCan't resolve 'kubernetes' by skydns serivce in KubernetesKubernetes equivalent of env-file in DockerContainer Port Not Exposed in Kuberneteskubernetes service return refusedHow to access kubernete pods on my development environment?How to start a pod in command line without deployment in kubernetes?How to map one single file into kubernetes pod using hostPath?Pods on different nodes can't ping each otherWhy Kubernetes config file for ThingsBoard service use TCP for CoAP?Kubeadm join fail. Is my master cluster IP 192.168.0.9 or 10.96.0.1?

Is it really a problem to declare that a visitor to the UK is my "girlfriend", in terms of her successfully getting a Standard Visitor visa?

Backpacking with incontinence

How to derive trigonometric Cartesian equation from parametric

How to get Planck length in meters to 6 decimal places

Why do we need a voltage divider when we get the same voltage at the output as the input?

Disease transmitted by postage stamps

Can the additional attack from a Samurai's Rapid Strike have advantage?

The grades of the students in a class

Why did the United States not resort to nuclear weapons in Vietnam?

Why doesn't this proof show that the operation on a factor group is well-defined?

Guidelines for writing a chord progression

How can a class have multiple methods without breaking the single responsibility principle

Derivative is just speed of change?

Is the EU really banning "toxic propellants" in 2020? How is that going to work?

"Will flex for food". What does this phrase mean?

Being told my "network" isn't PCI Complaint. I don't even have a server! Do I have to comply?

IBM mainframe classic executable file formats

Is Norway in the Single Market?

describing weighing an object in hand

Can I shorten this filter, that finds disk sizes over 100G?

What Marvel character has this 'W' symbol?

Can living where magnetic ore is abundant provide any protection from cosmic radiation?

How can flights operated by the same company have such different prices when marketed by another?

How do discovery writers hibernate?



Kubernetes pod can't access other pods exposed by a service


Can't resolve 'kubernetes' by skydns serivce in KubernetesKubernetes equivalent of env-file in DockerContainer Port Not Exposed in Kuberneteskubernetes service return refusedHow to access kubernete pods on my development environment?How to start a pod in command line without deployment in kubernetes?How to map one single file into kubernetes pod using hostPath?Pods on different nodes can't ping each otherWhy Kubernetes config file for ThingsBoard service use TCP for CoAP?Kubeadm join fail. Is my master cluster IP 192.168.0.9 or 10.96.0.1?






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








1















New to Kubernetes.



To build our testing environment, I'm trying to set up a PostgreSQL instance in Kubernetes, that's accessible to other pods in the testing cluster.



The pod and service are both syntactically valid and running. Both show in the output from kubectl get [svc/pods]. But when another pod tries to access the database, it times out.



Here's the specification of the pod:



# this defines the postgres server
apiVersion: v1
kind: Pod
metadata:
name: postgres
labels:
app: postgres
spec:
hostname: postgres
restartPolicy: OnFailure
containers:
- name: postgres
image: postgres:9.6.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
protocol: TCP


And here is the definition of the service:



# this defines a "service" that makes the postgres server publicly visible
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
type: ClusterIP
ports:
- port: 5432
protocol: TCP


I'm certain that something is wrong with at least one of those, but I'm not sufficiently familiar with Kubernetes to know which.



If it's relevant, we're running on Google Kubernetes Engine.



Help appreciated!










share|improve this question
























  • how do you hit postgres db from other pod?

    – P Ekambaram
    Mar 27 at 7:07






  • 2





    Are pods and Postgres on the same namespace? How are you trying to connect to Postgres from your app? Which DNS/hostname are you using?

    – Jose Armesto
    Mar 27 at 9:43











  • @fiunchinho Yes, both the pods are in the same dev namespace. For our app, we've got something in Python that uses SQLAlchemy. We're also using the tenacity package to handle retrying, so we're eventually just getting a time-out related error from tenacity.

    – Eric Fulmer
    Mar 27 at 14:57






  • 1





    can you share the connection string?

    – Jose Armesto
    Mar 27 at 15:09






  • 1





    can you try to exec into one of your containers (preferably the python container) and try to curl postgres:5432? also - is the service supposed to be exposed outside the cluster? you can try for testing purposes to remove type: ClusterIP

    – Amityo
    Mar 28 at 14:00

















1















New to Kubernetes.



To build our testing environment, I'm trying to set up a PostgreSQL instance in Kubernetes, that's accessible to other pods in the testing cluster.



The pod and service are both syntactically valid and running. Both show in the output from kubectl get [svc/pods]. But when another pod tries to access the database, it times out.



Here's the specification of the pod:



# this defines the postgres server
apiVersion: v1
kind: Pod
metadata:
name: postgres
labels:
app: postgres
spec:
hostname: postgres
restartPolicy: OnFailure
containers:
- name: postgres
image: postgres:9.6.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
protocol: TCP


And here is the definition of the service:



# this defines a "service" that makes the postgres server publicly visible
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
type: ClusterIP
ports:
- port: 5432
protocol: TCP


I'm certain that something is wrong with at least one of those, but I'm not sufficiently familiar with Kubernetes to know which.



If it's relevant, we're running on Google Kubernetes Engine.



Help appreciated!










share|improve this question
























  • how do you hit postgres db from other pod?

    – P Ekambaram
    Mar 27 at 7:07






  • 2





    Are pods and Postgres on the same namespace? How are you trying to connect to Postgres from your app? Which DNS/hostname are you using?

    – Jose Armesto
    Mar 27 at 9:43











  • @fiunchinho Yes, both the pods are in the same dev namespace. For our app, we've got something in Python that uses SQLAlchemy. We're also using the tenacity package to handle retrying, so we're eventually just getting a time-out related error from tenacity.

    – Eric Fulmer
    Mar 27 at 14:57






  • 1





    can you share the connection string?

    – Jose Armesto
    Mar 27 at 15:09






  • 1





    can you try to exec into one of your containers (preferably the python container) and try to curl postgres:5432? also - is the service supposed to be exposed outside the cluster? you can try for testing purposes to remove type: ClusterIP

    – Amityo
    Mar 28 at 14:00













1












1








1








New to Kubernetes.



To build our testing environment, I'm trying to set up a PostgreSQL instance in Kubernetes, that's accessible to other pods in the testing cluster.



The pod and service are both syntactically valid and running. Both show in the output from kubectl get [svc/pods]. But when another pod tries to access the database, it times out.



Here's the specification of the pod:



# this defines the postgres server
apiVersion: v1
kind: Pod
metadata:
name: postgres
labels:
app: postgres
spec:
hostname: postgres
restartPolicy: OnFailure
containers:
- name: postgres
image: postgres:9.6.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
protocol: TCP


And here is the definition of the service:



# this defines a "service" that makes the postgres server publicly visible
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
type: ClusterIP
ports:
- port: 5432
protocol: TCP


I'm certain that something is wrong with at least one of those, but I'm not sufficiently familiar with Kubernetes to know which.



If it's relevant, we're running on Google Kubernetes Engine.



Help appreciated!










share|improve this question














New to Kubernetes.



To build our testing environment, I'm trying to set up a PostgreSQL instance in Kubernetes, that's accessible to other pods in the testing cluster.



The pod and service are both syntactically valid and running. Both show in the output from kubectl get [svc/pods]. But when another pod tries to access the database, it times out.



Here's the specification of the pod:



# this defines the postgres server
apiVersion: v1
kind: Pod
metadata:
name: postgres
labels:
app: postgres
spec:
hostname: postgres
restartPolicy: OnFailure
containers:
- name: postgres
image: postgres:9.6.6
imagePullPolicy: IfNotPresent
ports:
- containerPort: 5432
protocol: TCP


And here is the definition of the service:



# this defines a "service" that makes the postgres server publicly visible
apiVersion: v1
kind: Service
metadata:
name: postgres
spec:
selector:
app: postgres
type: ClusterIP
ports:
- port: 5432
protocol: TCP


I'm certain that something is wrong with at least one of those, but I'm not sufficiently familiar with Kubernetes to know which.



If it's relevant, we're running on Google Kubernetes Engine.



Help appreciated!







kubernetes google-kubernetes-engine






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 23:03









Eric FulmerEric Fulmer

4141 gold badge4 silver badges16 bronze badges




4141 gold badge4 silver badges16 bronze badges















  • how do you hit postgres db from other pod?

    – P Ekambaram
    Mar 27 at 7:07






  • 2





    Are pods and Postgres on the same namespace? How are you trying to connect to Postgres from your app? Which DNS/hostname are you using?

    – Jose Armesto
    Mar 27 at 9:43











  • @fiunchinho Yes, both the pods are in the same dev namespace. For our app, we've got something in Python that uses SQLAlchemy. We're also using the tenacity package to handle retrying, so we're eventually just getting a time-out related error from tenacity.

    – Eric Fulmer
    Mar 27 at 14:57






  • 1





    can you share the connection string?

    – Jose Armesto
    Mar 27 at 15:09






  • 1





    can you try to exec into one of your containers (preferably the python container) and try to curl postgres:5432? also - is the service supposed to be exposed outside the cluster? you can try for testing purposes to remove type: ClusterIP

    – Amityo
    Mar 28 at 14:00

















  • how do you hit postgres db from other pod?

    – P Ekambaram
    Mar 27 at 7:07






  • 2





    Are pods and Postgres on the same namespace? How are you trying to connect to Postgres from your app? Which DNS/hostname are you using?

    – Jose Armesto
    Mar 27 at 9:43











  • @fiunchinho Yes, both the pods are in the same dev namespace. For our app, we've got something in Python that uses SQLAlchemy. We're also using the tenacity package to handle retrying, so we're eventually just getting a time-out related error from tenacity.

    – Eric Fulmer
    Mar 27 at 14:57






  • 1





    can you share the connection string?

    – Jose Armesto
    Mar 27 at 15:09






  • 1





    can you try to exec into one of your containers (preferably the python container) and try to curl postgres:5432? also - is the service supposed to be exposed outside the cluster? you can try for testing purposes to remove type: ClusterIP

    – Amityo
    Mar 28 at 14:00
















how do you hit postgres db from other pod?

– P Ekambaram
Mar 27 at 7:07





how do you hit postgres db from other pod?

– P Ekambaram
Mar 27 at 7:07




2




2





Are pods and Postgres on the same namespace? How are you trying to connect to Postgres from your app? Which DNS/hostname are you using?

– Jose Armesto
Mar 27 at 9:43





Are pods and Postgres on the same namespace? How are you trying to connect to Postgres from your app? Which DNS/hostname are you using?

– Jose Armesto
Mar 27 at 9:43













@fiunchinho Yes, both the pods are in the same dev namespace. For our app, we've got something in Python that uses SQLAlchemy. We're also using the tenacity package to handle retrying, so we're eventually just getting a time-out related error from tenacity.

– Eric Fulmer
Mar 27 at 14:57





@fiunchinho Yes, both the pods are in the same dev namespace. For our app, we've got something in Python that uses SQLAlchemy. We're also using the tenacity package to handle retrying, so we're eventually just getting a time-out related error from tenacity.

– Eric Fulmer
Mar 27 at 14:57




1




1





can you share the connection string?

– Jose Armesto
Mar 27 at 15:09





can you share the connection string?

– Jose Armesto
Mar 27 at 15:09




1




1





can you try to exec into one of your containers (preferably the python container) and try to curl postgres:5432? also - is the service supposed to be exposed outside the cluster? you can try for testing purposes to remove type: ClusterIP

– Amityo
Mar 28 at 14:00





can you try to exec into one of your containers (preferably the python container) and try to curl postgres:5432? also - is the service supposed to be exposed outside the cluster? you can try for testing purposes to remove type: ClusterIP

– Amityo
Mar 28 at 14:00












0






active

oldest

votes










Your Answer






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

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

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

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
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%2f55367424%2fkubernetes-pod-cant-access-other-pods-exposed-by-a-service%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















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%2f55367424%2fkubernetes-pod-cant-access-other-pods-exposed-by-a-service%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

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

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

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