i have an integration with runpod in python. after i deploy a pod, i want to show the user the ip

and ports
4 Replies
nerdylive
nerdylive•5d ago
https://discord.com/channels/912829806415085598/948767517332107274/1317164416000593971
curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.runpod.io/graphql?api_key={key}' \
--data '{"query": "query Pod { pod(input: {podId: \"{podid}\"}) { id runtime { uptimeInSeconds ports { ip isIpPublic privatePort publicPort type } } } }"}'
curl --request POST \
--header 'content-type: application/json' \
--url 'https://api.runpod.io/graphql?api_key={key}' \
--data '{"query": "query Pod { pod(input: {podId: \"{podid}\"}) { id runtime { uptimeInSeconds ports { ip isIpPublic privatePort publicPort type } } } }"}'
Colin S 🥯
Colin S 🥯OP•5d ago
bagel@192 bagel % curl --request POST \ --header 'content-type: application/json' \ --url 'https://api.runpod.io/graphql?api_key=rpa_S8G1...EU41wuktix' \ --data '{"query": "query Pod { pod(input: {podId: "{podid}"}) { id runtime { uptimeInSeconds ports { ip isIpPublic privatePort publicPort type } } } }"}' {"data":{"pod":null}} that doesn't seem to work either. there is a pod running, and api key is right I need to be able to deploy a pod programmatically and get the ip.
!Xabbu
!Xabbu•5d ago
I faced the same issue and had to find out the hard way that it doesn't seem possible to do this via API alone (even GraphQL). I tried creating community / secure pods and neither provided an IP from even a GraphQL machine subquery (I had to dig hard to reverse engineer how to do this). I gave up and had to rely on the UI for information on how to ssh in.
flash-singh
flash-singh•5d ago
i just tried this and it works, output:
{"data":{"pod":{"id":"xx","runtime":{"uptimeInSeconds":98,"ports":[{"ip":"213.181.xx.xx","isIpPublic":true,"privatePort":22,"publicPort":55073,"type":"tcp"},{"ip":"100.65.22.xxx","isIpPublic":false,"privatePort":8888,"publicPort":60237,"type":"http"},{"ip":"100.65.22.xxx","isIpPublic":false,"privatePort":19123,"publicPort":60238,"type":"http"}]}}}}
{"data":{"pod":{"id":"xx","runtime":{"uptimeInSeconds":98,"ports":[{"ip":"213.181.xx.xx","isIpPublic":true,"privatePort":22,"publicPort":55073,"type":"tcp"},{"ip":"100.65.22.xxx","isIpPublic":false,"privatePort":8888,"publicPort":60237,"type":"http"},{"ip":"100.65.22.xxx","isIpPublic":false,"privatePort":19123,"publicPort":60238,"type":"http"}]}}}}
you can see where isIpPublic is true and ip is a public ip, it exposes 22 port on 55073 public port i create a pod in secure cloud using 4090 you also have to make sure a port is exposed in tcp, that will expose a port using public ip
Want results from more Discord servers?
Add your server