I am new to kubernetes and not able to troubleshoot the issue. service and pod is running but I am not able to get the response from the postman.
kubectl get service
kubectl get service personservice -o json
{
"apiVersion": "v1",
"kind": "Service",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"app\":\"personservice\"},\"name\":\"personservice\",\"namespace\":\"default\"},\"spec\":{\"ports\":[{\"nodePort\":30001,\"port\":8080,\"protocol\":\"TCP\"}],\"selector\":{\"app\":\"personservice\"},\"type\":\"NodePort\"}}\n"
},
"creationTimestamp": "2019-11-07T11:22:04Z",
"labels": {
"app": "personservice"
},
"name": "personservice",
"namespace": "default",
"resourceVersion": "84920",
"selfLink": "/api/v1/namespaces/default/services/personservice",
"uid": "d32d4dd8-0150-11ea-80e6-00155d010311"
},
"spec": {
"clusterIP": "10.98.168.74",
"externalTrafficPolicy": "Cluster",
"ports": [
{
"nodePort": 30001,
"port": 8080,
"protocol": "TCP",
"targetPort": 8080
}
],
"selector": {
"app": "personservice"
},
"sessionAffinity": "None",
"type": "NodePort"
},
"status": {
"loadBalancer": {}
}
}
kubectl get pods
when I am trying to hit it using postman
http://100.120.60.210:30001/getPerson?nino=12345Ac&id=1
I get "There was an error connecting to http://100.120.60.210:30001/getPerson?nino=12345Ac&id=1."
IPv4 Address. . . . . . . . . . . : 100.120.60.210 --- Ip address of my laptop.
Edit 1: pod deploy config:
apiVersion: apps/v1
kind: Deployment
metadata:
name: personservice
labels:
app: personservice
spec:
replicas: 1
selector:
matchLabels:
app: personservice
template:
metadata:
labels:
app: personservice
spec:
containers:
- name: personservice
image: microservice-k8s/personmicroservice-k8s:1.0
ports:
- containerPort: 8080
env:
- name: PROFILE
value: "dev"
- name: SERVER_PORT
value: "8080"
- name: ZIPKIN_URI
value: "http://100.120.60.210:9411"
Edit 2:
I have deployed another pod and service to test and it is working. Ran this command for both the service kubectl get service personservice -o json The only diff I found is following:
Non-working service
"status": {
"loadBalancer": {}
}
working service:
"status": {
"loadBalancer": {
"ingress": [
{
"hostname": "localhost"
}
]
}
}
what could be the reason behind the empty status?
Edit 3:
Port forwarding to the pod and accessing it through http://localhost:7000 is working.
kubectl port-forward personservice-5c66cfcb89-dd6l7 7000:8080
This means something is wrong with the service only.