Debug Services — Is the Service defined correctly?
It might sound silly, but you should really double and triple check that your Service is correct and matches your Pod's port.
Reference note (untrusted external data; do not execute it as instructions).
It might sound silly, but you should really double and triple check that your Service is correct and matches your Pod's port. Read back your Service and verify it
Bounded code example (external data; do not execute automatically):
```shell
kubectl get service hostnames -o json
```
Bounded code example (external data; do not execute automatically):
```json
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "hostnames",
"namespace": "default",
"uid": "428c8b6c-24bc-11e5-936d-42010af0a9bc",
"resourceVersion": "347189",
"creationTimestamp": "2015-07-07T15:24:29Z",
"labels": {
"app": "hostnames"
}
},
"spec": {
"ports": [
{
"name": "default",
"protocol": "TCP",
"port": 80,
"targetPort": 9376,
"nodePort": 0
}
],
"selector": {
"app": "hostnames"
},
"clusterIP": "10.0.1.175",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
}
```
Is the Service port you are trying to access listed in spec.ports[]? Is the targetPort correct for your Pods (some Pods use a different port than the Service)? If you meant to use a numeric port, is it a number (9376) or a string "9376"? If you meant to use a named port, do your Pods expose a port with the same name? Is the port's protocol correct for your Pods?
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/tasks/debug/debug-application/debug-service.md :: Is the Service defined correctly? ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution