2

Following the tutorial for Kubernetes (in my case on GKE) https://docs.traefik.io/v2.0/user-guides/crd-acme/ I am stuck on how to assign the global static IP (GKE wants a forwarding rule). Am I missing something (e.g. adding another ingress)? I understand that annotations are not possible in the IngressRoute. So how would I assign the global reserved IP?

The answer to question 3 on this Q&A online meetup (https://gist.github.com/dduportal/13874113cf5fa1d0901655e3367c31e5) mentions that "classic ingress" is also possible with version 2.x. Does this mean I can set up traefik as in 1.x (like this: https://docs.traefik.io/user-guide/kubernetes/) use 2.x configuration and no need for CRD?

4

1 回答 1

1

您可以像使用其他所有 Ingress Controller 一样进行操作。

nginx-ingress 的网站上提供了有关如何将静态 IP 地址分配给 Ingress 的良好分步说明。

按照名为“将临时 IP 提升为静态 IP ”的部分进行操作

如果要遵循 Traefik 2.0 为 Kubernetes 制作的示例清单文件,一旦您修补 Traefik 的 K8S 服务(使用 kubectl patch traefik...),您可以使用以下命令验证 IngressRoute 是否生效:

 curl -i http://<static-ip-address>:8000/notls -H 'Host: your.domain.com'

更新

apiVersion: v1
kind: Service
metadata:
  name: traefik
spec:
  ports:
    - protocol: TCP
      name: web
      port: 8000
    - protocol: TCP
      name: admin
      port: 8080
    - protocol: TCP
      name: websecure
      port: 4443
  selector:
    app: traefik
  type: LoadBalancer

并修补它:

kubectl patch svc traefik -p '{"spec": {"loadBalancerIP": "<your_static_ip>"}}'
于 2019-05-16T14:52:08.233 回答