Closed HarrisKirk closed 1 year ago
kubectl get svc gwa --output=json
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"gwa\"},\"name\":\"gwa\",\"namespace\":\"default\"},\"spec\":{\"ports\":[{\"nodePort\":30050,\"port\":8000,\"protocol\":\"TCP\"}],\"selector\":{\"app\":\"gwa\"},\"type\":\"LoadBalancer\"}}\n"
},
"creationTimestamp": "2023-02-24T23:58:09Z",
"finalizers": [
"service.kubernetes.io/load-balancer-cleanup"
],
"labels": {
"app": "gwa"
},
"name": "gwa",
"namespace": "default",
"resourceVersion": "811",
"uid": "ddac39a0-87ee-4e1c-b674-3a89907754e7"
},
"spec": {
"allocateLoadBalancerNodePorts": true,
"clusterIP": "10.128.15.147",
"clusterIPs": [
"10.128.15.147"
],
"externalTrafficPolicy": "Cluster",
"internalTrafficPolicy": "Cluster",
"ipFamilies": [
"IPv4"
],
"ipFamilyPolicy": "SingleStack",
"ports": [
{
"nodePort": 30050,
"port": 8000,
"protocol": "TCP",
"targetPort": 8000
}
],
"selector": {
"app": "gwa"
},
"sessionAffinity": "None",
"type": "LoadBalancer"
},
"status": {
"loadBalancer": {
"ingress": [
{
"hostname": "143-42-127-204.ip.linodeusercontent.com",
"ip": "143.42.127.204"
}
]
}
}
}
Read more about how to obtain the IP address to use to hit the service. Once it works, then modify the python code to extract it with kubectl
DONE=What I believe to be the IP address is being logged after the service is started.
This url works: curl http://143.42.127.204:8000