mmumshad / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way on Vagrant on Local Machine. No scripts.
Apache License 2.0
4.7k stars 4.54k forks source link

Service Discovery outside Cluster #42

Closed pratapbreddy2011 closed 2 years ago

pratapbreddy2011 commented 5 years ago

Hi mmumshad, over I have configured a kubernetes cluster through kubernetes-the-hard-way and the cluster is working fine.

I am able to do a service discovery inside cluster through busybox but now able to discover service outside cluster. Can you let me know how to configure to make service discovery outside cluster? Also exposed clusterIP but it is in pending state.

INSIDE CLUSTER

[dadmin@k8s-master-01 ~]$ kubectl exec -ti busybox -- nslookup my-service Server: 10.96.0.10 Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name: my-service Address 1: 10.96.0.163 my-service.default.svc.cluster.local [dadmin@k8s-master-01 ~]$

OUTSIDE CLUSTER

[dadmin@k8s-master-01 ~]$ kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 443/TCP 4d10h my-service LoadBalancer 10.96.0.163 8080:31222/TCP 26m mydb ClusterIP 10.96.0.136 80/TCP 28h myservice ClusterIP 10.96.0.127 80/TCP 28h nginx NodePort 10.96.0.157 80:31994/TCP 3h2m [dadmin@k8s-master-01 ~]$ nslookup my-service Server: 8.8.8.8 Address: 8.8.8.8#53

** server can't find my-service: NXDOMAIN

[dadmin@k8s-master-01 ~]$

pratapbreddy2011 commented 5 years ago

small typo.

I am able to do a service discovery inside cluster through busybox but now am not able to discover service outside cluster. Can you let me know how to configure to make service discovery outside cluster? Also exposed clusterIP but it is in pending state.

pratapbreddy2011 commented 5 years ago

Any update on this?