I installed minikube to use kubernetes locally. I was able to create pods and services locally.
However, pods (and containers) running on them, cannot resolve services using service names.
Example: I have redis service running that acts a proxy for redis pods.
kubectl get services
shows taht redis service has been created.
However, when my web application tries to connect to redis-service
, I get connection timeout, because web application (pod) cannot resolve redis-service
.
Is there anything special taht needs to be installed to get service resolution working locally.
this is the output of running kubectl get services
frontend 10.0.0.250 80/TCP 3h
kubernetes 10.0.0.1 <none> 443/TCP 3h
redis-service 10.0.0.156 <none> 6379/TCP 3h
rethinkdb-service 10.0.0.89 <none> 28015/TCP 3h
kubectl describe services --namespace=kube-system
Name: kube-dns
Namespace: kube-system
Labels: k8s-app=kube-dns,kubernetes.io/name=KubeDNS
Selector: <none>
Type: ClusterIP
IP: 10.0.0.10
Port: dns 53/UDP
Endpoints: 10.0.2.15:53
Port: dns-tcp 53/TCP
Endpoints: 10.0.2.15:53
Session Affinity: None
No events.
Name: kubernetes-dashboard
Namespace: kube-system
Labels: app=kubernetes-dashboard,kubernetes.io/cluster-service=true
Selector: app=kubernetes-dashboard
Type: NodePort
IP: 10.0.0.156
Port: <unset> 80/TCP
NodePort: <unset> 30000/TCP
Endpoints: 172.17.0.2:9090
Session Affinity: None
No events.
You need to expose your services as type: NodePort
in minikube instead of ClusterIP
You can then access them with minikube service <servicename>
(or you can find out which port they were mapped manually to with kubectl get services
)