Reputation: 11
I'm trying to use LoadBalancer as a service to a pod. The container inside the pod (single container pod) is listening to port 8080 for receiving packets over UDP. I have checked the container manually and it is doing fine its part. However I'm unable to send packets from my host machine to my pod which is inside minikube cluster after creating a LoadBalancer service.
Here is my pod and service yaml file. I want to send packets to my pod inside the cluster. I've created a service which you can have look into.
The service does listen but I really don't understand where the packets are forwarded after I send it to externalIP:nodePort.
For POD
apiVersion: v1
kind: Pod
metadata:
name: tstream-deb
labels:
app: tstream-deb
spec:
containers:
- name: tstream-deb
image: tstream-deb
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
protocol: UDP
Service
apiVersion: v1
kind: Service
metadata:
name: tstream-deb
labels:
app: tstream-deb
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
nodePort: 30001
protocol: UDP
selector:
name: tstream-deb
app: tsream-deb
~
So my pod basically listens for a packet/message and does something in Golang, which I tested locally as well as within the container which works exactly fine.
How can I interact with my pod from localhost to inside of minikube cluster. I've tried minikube tunnel too but of no help.
Upvotes: 1
Views: 103
Reputation: 13215
Seems like the issue is with using <externalIP>:<nodePort>
as network address.
It should be either
<externalIP>:<servicePort>(80)
or
<nodeIP>:<nodePort>(30001)
You can also use port-forward from host machine to check the services
kubectl port-forward svc/tstream-deb 3000:80
With this setting use localhost:3000
as the network address
Upvotes: 0