Pod is working but not working in cluster

tom@tom:~$ cat serv.yml
apiVersion: v1
kind: Service
metadata:
name: example-prod
spec:
type: NodePort
ports:

  • targetPort: 80
    port: 80
    nodePort: 30008
    selector:
    app: myapp
    type: front-end

tom@tom:~$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
example-prod NodePort 10.102.119.57 80:30008/TCP 128m
kubernetes ClusterIP 10.96.0.1 443/TCP 144m

Hi @robi050993,
Sorry, I don’t get your point. Can you please share more details? What do you mean by “pod is working but not working in cluster”?
What do I have to do with the service YAML file? Please share the Pod defnition file, also.

Did you see any error?

Regards,

Thank you Tej,I started to learning kubernetes now,thats only i am not able to clear my issue.

my ngnix pod is working fine.I loged in ngnix pod and ab;e to access port inside pod,But not able to access outside pod.How to get access it through nodeport service.

Hi @robi050993,
You need to expose the pod by creating a service.
Check this tutorial to see how it’s work :

1 Like

Thanks for sharing the tutorial, @mmkmou . :+1: :ok_hand: