本文介绍了配置Kubernetes Nginx进行外部访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我还是Kubernetes和Lagom的新手.

I'm still new to Kubernetes and Lagom.

我需要从外部服务器调用我的Lagom微服务.为此,我认为我需要公开我的Nginx入口以进行外部访问,但是我不知道该怎么做.我应该配置外部IP"吗?

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"
    }
  }
}

推荐答案

Minikube为自身和VM创建网络.您需要从外部公开您的服务.

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

来自Op的评论:您将获得服务的端口30370.您需要公开此端口.

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

这篇关于配置Kubernetes Nginx进行外部访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 19:00