0

I have deployed and created services for socketcluster, scc-broker and scc-state on kubernetes locally via minikube directly through using the docker-files (see this link for .yaml files). And I have also created a service for ingress within the same cluster with the .yaml file provided in the link that I have mentioned. As far as I understand by default these services are of ClusterIP type.

Deployment of the services is working properly on the vm (minikube). Status is set to running on the Kubernetes dashboard for

  • pods

  • deployment

But the issue I am facing is that there is no public endpoints exposed from scc-state, scc-broker, socketcluster server. So currently I am not able to understand how do I access the services externally i.e. outside the virtual machine (that is running on minikube).

The images were built from the kubernetes yml files directly, with the ingress TLS security disabled.

Am I missing out on any aspect as to how to access the socketcluster on the host machine? Should I specify the service type to any other type other than ClusterIP as I know that using this type ensures that the service will be exposed within cluster only. But again my doubt is that if I am using ingress , it should help access the services outside the vm. Do I need to have an ingress controller separately such as NGINX ?

Any lead will be appreciate.

Thanks!

P.S. Following this guide to for the deployment.

ahmet alp balkan
  • 42,679
  • 38
  • 138
  • 214
Roshan
  • 150
  • 16

2 Answers2

1

If you follow minikube documentation, https://github.com/kubernetes/minikube#quickstart, it tells you to create a Service with type: NodePort.

Then run kubectl get services to find the assigned IP number for your service, and use minikube ip to find IP address of minikube VM. Then put these two together and access the service from your laptop.

ahmet alp balkan
  • 42,679
  • 38
  • 138
  • 214
  • thanks for your response, but what I think that putting services as clusterIP/NodePort will not effect if I am using an ingress controller to expose my services to outside world .correct me if I am wrong. – Roshan Apr 27 '17 at 07:05
1

Kubernetes doesn't expose anything outside the private container network unless you specifically tell it to. The common ways to do that are

  • Use a Service with type: LoadBalancer to get a public IP attached to a cloud service. This isn't available on minikube
  • Use a Service with type: NodePort to expose a port on each node's public network. This is the recommended way to do things on minikube (https://github.com/kubernetes/minikube#networking)
  • Create your pods with hostNetwork: true to skip the container network and use the host network (e.g. sharing the same IP as the node itself). This is generally less useful than the previous two options except in very specific circumstances.

The Ingress resource isn't related to external connectivity. If you have an ingress-controller deployed, it will use the Ingress resources you create to configure itself. For example, the nginx-ingress-controller (https://github.com/kubernetes/ingress/tree/master/controllers/nginx) will essentially create a server block in the nginx configuration for each Ingress. However, the ingress-controller itself would still need to be exposed to the external network using a Service with type: LoadBalancer or type: NodePort.

coreypobrien
  • 1,921
  • 17
  • 17
  • So do you mean that ..? I don't need to have any ingress/ingress controller service if I just put my services in the `kubernetes` as NodePort type ..?? – Roshan Apr 28 '17 at 07:00
  • That's correct. If you set your service as `type: NodePort`, the underlying pods will be exposed on the IP of minikube (e.g. 192.168.99.1) – coreypobrien Apr 28 '17 at 17:23
  • Thanks @coreypobrien ! – Roshan May 01 '17 at 07:11
  • One more question, As I am going to have multiple replica of pods for scaling purpose, so in that case I need to have a load balancer deployed insider the kubernetes which does the reverse-proxy, am I right ..? – Roshan May 02 '17 at 04:56
  • You still shouldn't need anything besides the service. A Kubernetes `Service` with `type: ClusterIP` will direct connections to any available pod. Here's a graphic from the docs: https://kubernetes.io/images/docs/services-iptables-overview.svg – coreypobrien May 02 '17 at 13:44