Not able to access the service

7/11/2019

I have deployed an application to the kubernetes and service exposed of type NodePort, howerver I'm not able to access this application.

I have tried accessing the application by using PUBLIC_IP:32000 but I am getting site can't be reached

Note: I have created K8S cluster on my Google servers

[root@kmaster kube-ops-view]# kubectl get svc
NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kube-ops-view         NodePort    10.100.137.77   <none>        80:32000/TCP   10m
kube-ops-view-redis   ClusterIP   10.98.40.11     <none>        6379/TCP       10m
kubernetes            ClusterIP   10.96.0.1       <none>        443/TCP        28m
[root@kmaster kube-ops-view]#
-- ratnakar reddy
kubernetes

1 Answer

7/15/2019

The problem might be in that you also needed to configure service/deployment configuration file and change the selector to match the label in the pod.

If pod has "app=my-app" tag, but service selector had "name=my-app". Matching them my fixed the access problem.

If the cluster node is somewhere else and you want to make the port available on you local client , then just do kubectl port forward:

$ kubectl port-forward svc/your-service-name port:port
-- MaggieO
Source: StackOverflow