Sykomaniac
Sykomaniac

Reputation: 175

Minikube networking

I have a Linux build machine that I have installed minikube too. Within the minikube instance I have installed artifactory which I will be using for storing various build artifacts

I now want to be able to do some work on my dev machine (which is an unrelated laptop on the same network as the Linux build machine) and push some built artifacts into artifactory.

However I can't figure out how to get to artifactory. When I ssh to the Linux server and check the minikube service I can see that the artifactory instance is running on a 192.168 address.

Is there any way to expose artifactory ie access it on the windows machine? Or is this not possible and I should just install artifactory on the Linux machine rather than in minikube?

Upvotes: 4

Views: 8375

Answers (3)

Sykomaniac
Sykomaniac

Reputation: 175

To get this to work in the end I setup ingress on minikube and then through entries in hosts file and nginx as a reverse proxy managed to get things working.

Upvotes: 2

Vikram Hosakote
Vikram Hosakote

Reputation: 3664

Yes, we need an ingress controller (like nginx) to expose a kubernetes service for external access.

There are three ways to create the nginx ingress service using kubernetes per https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types and expose it for external access:

  1. LoadBalancer service type which sets the ExternalIP automatically. This is used when there is an external non-k8s, cloud-provider's load-balancer like CGE, AWS or Azure, and this external load-balancer would provide the ExternalIP for the nginx ingress service.
  2. ExternalIPs per https://kubernetes.io/docs/concepts/services-networking/service/#external-ips.
  3. NodePort. In this approach, the service can be accessed from outside the cluster using NodeIP:NodePort/url/of/the/service.

Along with the nginx ingress controller, you'll need an ingress resource too. Refer https://github.com/nginxinc/kubernetes-ingress/tree/master/examples/complete-example for examples.

Keep in mind that Minikube is a small VM with a small docker registry by default. So, it may not be possible to store a lot of build artifacts in Minikube.

Upvotes: 2

Shahriar
Shahriar

Reputation: 13806

Expose you artifactory Service

$ minikube service <artifactory-service> -n <namespace>

Or get the URL

$ minikube service <artifactory-service> -n <namespace> --url

If you want to access from remote, you need to do something else.

Suppose, when you run minikube service <artifactory-service> -n <namespace> --url, you get following

http://192.168.99.100:30654

You can access artifactory in minikube using this URL. But can't access from remote.

Now do this, expose port 30654

ssh -i ~/.minikube/machines/minikube/id_rsa docker@$(minikube ip) -L \*:30654:0.0.0.0:30654

You will be able to access from other network.

Upvotes: 4

Related Questions