Search code examples
nginxkuberneteslagom

Configure Kubernetes nginx for an external access


I'm still new to Kubernetes and Lagom.

I need to invoke my Lagom microservice from an external server. To do that, I think that I need to expose my nginx-ingress for an external access, but I don't know how. Should I configure an "externalIPs"?

{
  "apiVersion": "v1",
  "kind": "Service",
  "metadata": {
    "name": "nginx-ingress"
  },
  "spec": {
    "type": "LoadBalancer",
    "ports": [
      {
        "port": 80,
        "name": "http",
        "targetPort": 8080
      },
      {
        "port": 443,
        "name": "https"
      }
    ],
    "externalIPs": [
      "192.168.1.120"
    ],
    "selector": {
      "k8s-app": "nginx-ingress-lb"
    }
  }
}

Solution

  • Minikube creates a network for itself and the VM. You need to externally expose your service.

    From Op's comment: You get port 30370 for your Service. You need to expose this port.

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