Kubernetes:使用 Let's Encrypt 公开 NGINX Ingress

Kubernetes: exposing NGINX Ingress with Let's Encrypt

我正在尝试使用证书管理器设置 LetsEncrypt SSL 证书。 我已经通过 Helm 成功部署了证书管理器并坚持配置 ingress.yaml.

$ sudo kubectl create --edit -f https://raw.githubusercontent.com/jetstack/cert-manager/master/docs/tutorials/quick-start/example/ingress.yaml

我知道了:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: nginx
  name: kuard
  namespace: default
spec:
  rules:
  - host: example.example.com
    http:
      paths:
      - backend:
          serviceName: kuard
          servicePort: 80
        path: /
  tls:
  - hosts:
    - example.example.com
    secretName: quickstart-example-tls

所以我只是将 example.com 中的主机替换为我的外部 IP 并得到了这个:

A copy of your changes has been stored to "/tmp/kubectl-edit-qx3kw.yaml"
The Ingress "kuard" is invalid: spec.rules[0].host: Invalid value: must be a DNS name, not an IP address

有什么方法可以只使用我的外部 IP 来设置它吗?我还没有为我的应用选择域名,只想使用普通 IP 进行演示和试用。

没有。您不能为 Ingress 使用 IP 地址。要使用 IP 地址,您需要将其配置为指向您的工作节点并创建一个 NodePort 服务,这将允许您浏览到 http://IP:NODEPORT.