Skip to content

Definicja Gateway w manifeście

Szablon definicji

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
    name: <gateway-name>
spec:
    gatewayClassName: <gatewayclass-name>
    listeners:
    - name: <listener-type>
      protocol: <listener-protocol>
      port: <listener-port>

Przykład definicji

Nazwa Gateway: example-gateway Nazwa GatewayClass: example-gatewayclass Rodzaj protokołu: http Port nasłuchujący: 80

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
    name: example-gateway
spec:
    gatewayClassName: example-gatewayclass
    listeners:
    - name: http
      protocol: HTTP
      port: 80

Definicja szyfrowania TLS

Wykorzystany do tego celu został Secret tls-secret.

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
    name: example-secure-gateway
spec:
    gatewayClassName: example-gatewayclass
    listeners:
    - name: https
      port: 443
      protocol: HTTPS
      tls:
          mode: Terminate
          certificateRefs:
          - kind: Secret
            name: tls-secret
         allowedRoutes:
             kinds:
             - kind: HTTPRoute