This means that the pod is scheduled with node affinity to nodes whose metadata name matches worker. So, the pod will only be scheduled on nodes named worker.
The hostPort binding for one container port:
hostPort: 80
name: lb-tcp-80
protocol: TCP
This means the pod container exposes port 80 on the host network interface (hostPort: 80). The container named lb-tcp-80 has TCP 80 bound to the host's port 80.
User
Events:
Type Reason Age From Message
Warning FailedScheduling 19h (x22 over 21h) default-scheduler 0/3 nodes are available: 1 node(s) didn't have free ports for the requested pod ports, 2 node(s) didn't satisfy plugin(s) [NodeAffinity]. preemption: 0/3 nodes are available: 1 node(s) didn't have free ports for the requested pod ports, 2 Preemption is not helpful for scheduling.
Warning FailedScheduling 10m (x2 over 15m) default-scheduler 0/3 nodes are available: 1 node(s) didn't have free ports for the requested pod ports, 2 node(s) didn't satisfy plugin(s) [NodeAffinity]. preemption: 0/3 nodes are available: 1 node(s) didn't have free ports for the requested pod ports, 2 Preemption is not helpful for scheduling.
vagrant@Master: kubectl get pod svclb-grafana-03ffa6f9-87fds -n kube-system -o yaml | grep -A10 hostPort
hostPort: 80
name: lb-tcp-80
protocol: TCP
resources: {}
securityContext:
capabilities:
add:
- NET_ADMIN
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
vagrant@Master:$
Assistant
The scheduling failure message:
0/3 nodes are available: 1 node(s) didn't have free ports for the requested pod ports, 2 node(s) didn't satisfy plugin(s) [NodeAffinity].
The pod has node affinity restricting it to run only on nodes named worker.
The container inside the pod binds host port 80 to its container port 80 for TCP traffic.
Affinity uses matchFields on metadata.name for node selection.
If you have further questions (e.g., about modifying affinity, port conflicts, troubleshooting scheduling, or deployment best practices), please let me know!
2 of those nodes do not satisfy the node affinity constraint: their node name is not worker.
1 node does satisfy node affinity but already has port 80 bound (busy host port), so it cannot schedule this pod since the pod requests hostPort: 80 which is not free.
What is happening?
Your pod affines to nodes whose metadata.name = worker.
Only one node is named worker.
That node is already running something using host port 80 or has no free port 80.
Other nodes are not named worker, so affinity fails on them.
Scheduler cannot place the pod; thus FailedScheduling.
Potential solutions:
Free up port 80 on the worker node:
Find what pod/daemonset/service is using hostPort 80.
Modify/remove it if possible, to free the port.
Remove or relax the node affinity:
If affinity is not strictly required, consider allowing scheduling on other nodes by changing nodeAffinity or removing it.
Change the hostPort requested in your pod:
If port 80 is busy, consider using a different host port in the pod spec.
Example: Instead of hostPort: 80, use a free port like hostPort: 8080.
Add more nodes named worker and ensure ports are free on those nodes.
How to check port usage on the worker node:
SSH into the worker node, then check which process is listening on port 80:
sudo netstat -tuln | grep ':80'
or
sudo lsof -i :80
Check the pods running on that node and whether any of them bind hostPort 80: