I have created a cluster with one master and 2 nodes.
I have deployed a nginx service on the node1 and node2 using replicas 4 from the master
I have created a 'NodePort' Service as below to make the nginx services running on node1 (2 pods) and node2 (2 pods) accessible from outside the network.
apiVersion: v1
kind: Service
metadata:
name: nginx-service
labels:
type: nginx-service
name: nginx-web-application
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30006
selector:
app: nginx
From each of the node (node1 and node2), if i curl the pods (pod1 and pod2) to the port 80, nginx is accessible.
After creation of above Service , I am trying to curl to the nginx service from master to the node1 and node2.
curl http://<ip of node1>:30006
curl http://<ip of node1>:30006
both commands are intermittently successful, means 2 times success, 3 times failure, 3 times success, 1 time failure....so on.
I have these three centos machines in a single network created via vagrant machine. these three machines are reachable over the internet, as well as they are reachable to each other.
As there are 2 nodes and each node having 2 pods, the connection to the nginx application should be persistent (it shouldnt be intermittant)
Below commands to access the nginx from the master machine should be reachable all the time. Please guide what is missing
curl http://<ip of node1>:30006
curl http://<ip of node1>:30006