I have a Kubernetes cluster installation with a master node and two worker nodes in centos 7 machine(On premise environment). Is there a way to access all deployed services(Built in and my micro service) that will be installed on Kubernetes through master node's ip?
I have used flannel network. My service is running on node port 30011. I am able to access my service from worker node ip and node port[192.23.12.X1:30011 and 192.23.12.X2:30011] port but I am not able to access the same service from master node[192.23.19.21:30011].
Here is my deployment and service yaml file
deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: am-profile
labels:
app: am-profile
spec:
replicas: 1
selector:
matchLabels:
app: am-profile
template:
metadata:
labels:
app: am-profile
spec:
containers:
- name: am-profile
image: 192.23.12.160:8083/am-setting:1.0.0
ports:
- containerPort: 8081
service.yaml
apiVersion: v1
kind: Service
metadata:
name: am-profile
labels:
app: am-profile
spec:
type: NodePort
ports:
- targetPort: 8081
port: 8081
nodePort: 30011
selector:
app: am-profile
I want to access this service like http://master-node:30011/hello. Every help is appreciated.
Here is ip table save out put
-A KUBE-NODEPORTS -p tcp -m comment --comment "default/subscriber-profile-service:" -m tcp --dport 30002 -j KUBE-MARK-MASQ
-A KUBE-NODEPORTS -p tcp -m comment --comment "default/subscriber-profile-service:" -m tcp --dport 30002 -j KUBE-SVC-IUSISESM6NEI4T53
-A KUBE-SERVICES ! -s 10.244.0.0/16 -d 10.107.113.5/32 -p tcp -m comment --comment "default/subscriber-profile-service: cluster IP" -m tcp --dport 8082 -j KUBE-MARK-MASQ
-A KUBE-SERVICES -d 10.107.113.5/32 -p tcp -m comment --comment "default/subscriber-profile-service: cluster IP" -m tcp --dport 8082 -j KUBE-SVC-IUSISESM6NEI4T53 [r –