Kubernetes Service Not Reachable Via NodePort

44 Views Asked by At

I have deployed my K8s cluster in CentOS which consists of 1 Master and 2 Nodes. I am exposing my services to the external world using NodePort. My service is -

---
apiVersion: v1
kind: Service
metadata:
  name: atcapi
  namespace: default
spec:
  selector:
    app: atcapi
  type: NodePort
  ports:
  - name: atcapi-http
    port: 57124
    targetPort: 80
    nodePort: 32510
    protocol: TCP
...

I am able to connect to the service using my worker node ip and NodePort but not using Master Node IP and NodePort.

1

There are 1 best solutions below

1
On

Not sure why you want to access service with Master IP.

i think it's expected only because master for managing the cluster not should be used for exposing the services.

You can setup the Ingress or service mesh to expose the service or Use Node port service with worker node IP.

Still, you are looking for that check your IP table & Firewall rules those might could be blocking your traffic.