かべぎわブログ

ブログです

Istio Ingress GatewayでTLS終端させる

こんなかんじ。

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: wawawa-credential
    hosts:
    - "*"
---
apiVersion: v1
kind: Service
metadata:
  name: httpd
  labels:
    app: httpd
    service: httpd
spec:
  ports:
  - name: http
    protocol: TCP
    port: 80
  selector:
    app: httpd
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: httpd-v1
  labels:
    app: httpd
    version: v1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: httpd
      version: v1
  template:
    metadata:
      labels:
        app: httpd
        version: v1
    spec:
      containers:
      - name: httpd
        image: httpd
        ports:
        - containerPort: 80
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: vs-httpd
spec:
  hosts:
  - "*"
  gateways:
  - gateway
  http:
  - match:
    - uri:
        exact: /
    route:
    - destination:
        host: httpd
        port:
          number: 80