Cannot acces Kubernetes service outside cluster

3/5/2019

I have created a Kubernetes service for my deployment and using a load balancer an external IP has been assigned along with the node port but I am unable to access the service from outside the cluster using the external IP and nodeport.

The service has been properly created and is up and running.

Below is my deployment:-

apiVersion: apps/v1
kind: Deployment
metadata:
  name: dev-portal
  labels:
    app: dev-portal
spec:
  replicas: 1
  selector:
    matchLabels:
      app: dev-portal
  template:
    metadata:
      labels:
        app: dev-portal
    spec:
      containers:
      - name: dev-portal
        image: bhavesh/ti-portal:develop
        imagePullPolicy: Always
        resources:
          requests:
            memory: "512Mi"
            cpu: "1"
          limits:
            memory: "1G"
            cpu: "1"
        ports:
        - containerPort: 9000
      imagePullSecrets:
      - name: regcred

---

apiVersion: v1
kind: Service
metadata:
  name: dev-portal
  labels:
    app: dev-portal
spec:
  selector:
    app: dev-portal
  ports:
  - protocol: TCP
    port: 9000
    targetPort: 9000
    nodePort: 30429
  type: LoadBalancer

For some reason, I am unable to access my service from outside and a message 'Refused to connect' is shown.

Update

The service is described using kubectl describe below:

Name:                     trakinvest-dev-portal
Namespace:                default
Labels:                   app=trakinvest-dev-portal
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"trakinvest-dev-portal"},"name":"trakinvest-dev-portal","...
Selector:                 app=trakinvest-dev-portal
Type:                     LoadBalancer
IP:                       10.245.185.62
LoadBalancer Ingress:     139.59.54.108
Port:                     <unset>  9000/TCP
TargetPort:               9000/TCP
NodePort:                 <unset>  30429/TCP
Endpoints:                <none>
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
-- Bhavesh
kubernetes

0 Answers