Welcome to the Linux Foundation Forum!

Unable to access service exposed via NodePort

nitibhatt
nitibhatt Posts: 3
edited December 2017 in LFS258 Class Forum

Hello,

   I have a K8S cluster with one master and two worker nodes (CNI flavor: Calico).  The cluster is formed using 3 EC2 ubuntu instances.  I have 3 pods running as below (distributed on worker nodes) as below

root@ip-172-31-26-89:/home/ubuntu# kubectl get pods

NAME               READY     STATUS    RESTARTS   AGE

echoserver         1/1           Running   0                     4d

echoserver-5xdbn   1/1      Running   0                    22m

echoserver-kl8d4   1/1       Running   0                    26m

 

 

I created a service with the below definition on the master.



apiVersion: v1
kind: Service
metadata:
name: echoserver
spec:
type: "NodePort"
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: echoserver

doing a describe on service gives below (kubectl describe services/echoserver)

Name:                     echoserver

Namespace:                default

Labels:                   <none>

Annotations:              <none>

Selector:                 app=echoserver

Type:                     NodePort

IP:                       10.106.88.19

Port:                     <unset>  8080/TCP

TargetPort:               8080/TCP

NodePort:                 <unset>  31434/TCP

Endpoints:                192.168.30.3:8080,192.168.9.65:8080,192.168.9.67:8080

Session Affinity:         None

External Traffic Policy:  Cluster

Events:                   <none>

When I try to access service using NodePort using curl, its hangs with error connection refused.

Please help as I am stuck.

Thanks,

Niti

 

Comments

Categories

Upcoming Training