Any help will be appreciated.
I'm trying to send a request from pod to pod inside a k8s cluster in the same namespace running on AWS.
I've added a pod that serves requests coming from port 5000, from within the pod I manage to run a curl command successfully:
curl -i \
--header "Content-Type: application/json" \
--request POST \
--data '[[5.1, 3.5, 1.4, 0.2]]' \
localhost:5000/predict
I've added a service to the pod to expose an endpoint so I can send traffic to it:
apiVersion: v1
kind: Service
metadata:
annotations:
name: sklearn-iris-bentoml-deployment-sklearn-iris-example
namespace: bentoml
ownerReferences:
selfLink: /api/v1/namespaces/bentoml/services/sklearn-iris-bentoml-deployment-sklearn-iris-example
labels:
run: my-bentoml
spec:
ports:
- name: http
port: 5000
protocol: TCP
targetPort: 5000
selector:
run: my-bentoml
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}
The service:
➜ kubectl get svc -n bentoml
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
sklearn-iris-bentoml-deployment-sklearn-iris-example ClusterIP 10.110.5.245 <none> 5000/TCP 5h6m
The endpoint:
➜ k get endpoints sklearn-iris-bentoml-deployment-sklearn-iris-example -n bentoml
NAME ENDPOINTS AGE
sklearn-iris-bentoml-deployment-sklearn-iris-example 10.110.115.108:5000 5h6m
When I try to connect through telnet from a different pod in the same namespace, it fails:
root@my-shell:/# telnet 10.110.115.108 5000
Trying 10.110.115.108...
telnet: Unable to connect to remote host: Connection refused
I'm not sure whether I should configure a DNS since I don't have intentions to send traffic from outside the cluster so the network is mainly focused inside the cluster