Closed xinyu7git closed 4 years ago
/kind/question
not in env
:
/ $ env
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_SERVICE_PORT=443
HOSTNAME=simple-udp-8wr2k-2fqzm
SHLVL=1
HOME=/home/server
AGONES_SDK_GRPC_PORT=9357
TERM=xterm
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
AGONES_SDK_HTTP_PORT=9358
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
KUBERNETES_SERVICE_HOST=10.96.0.1
PWD=/
/kind question
/label question
Are you using the game server SDK in your pod? You should be able to call the GameServer()
function (see https://agones.dev/site/docs/guides/client-sdks/#gameserver) to get all of the information that you can see from kubectl get gameserver simple-udp-8wr2k-2fqzm
within that pod.
Ok, i got the port by GameServer() Function in client-sdk , thanks!
[root@172-18-178-251 ~]# docker logs f293b4a35a43
+ /root/main
2020/01/07 15:50:21 Starting TCP server, listening on port 7654
2020/01/07 15:50:21 Creating SDK instance
2020/01/07 15:50:21 Starting Health Ping
2020/01/07 15:50:21 Marking this server as ready
gs= object_meta:<name:"gs-example-skh22" namespace:"default"
uid:"d2bb89d3-40b3-422c-89f9-623cfad56d70" resource_version:"250550"
generation:4 creation_timestamp:1578383417 annotations:<key:"agones.dev/sdk-version" value:"1.2.0" > >
spec:<health:<period_seconds:5 failure_threshold:3 initial_delay_seconds:5 > >
status:<state:"Scheduled" address:"172.18.178.251" ports:<name:"default" port:7167 > > err= <nil>
Sounds like your problem is resolved so I'm going to mark this as closed.
/close
I want to get gameservers port in a pod, like get "7126" in pod "simple-udp-8wr2k-2fqzm" , i can't find a way in docs, anyone konws?