IstioのIngress Gatewayを作成

This document uses Gateway and VirtualService.

出典: https://istio.io/latest/blog/2018/v1alpha3-routing/

(1) Create YAML

gateway.yml

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: doktor-gateway  # your Gateway Name
  namespace: production
spec:
  selector:
    istio: ingressgateway  # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: doktor
  namespace: production
spec:
  hosts:
  - "*"
  gateways:
  - doktor-gateway
  http:
  - route:
    - destination:
        host: front-app.front.svc.cluster.local

(2) Apply YAML

$ kubectl apply -f gateway.yml

$ kubectl get gateway -A
NAMESPACE    NAME             AGE
production   doktor-gateway   20m

(3) Disable Traefik with k3s

Edit k3s service

sudo vi /etc/systemd/system/k3s.service
ExecStart=/usr/local/bin/k3s \
    server \
ExecStart=/usr/local/bin/k3s \
    server \
    --disable traefik

Restart and Apply

sudo systemctl daemon-reload
sudo systemctl restart k3s

Ref) https://rancher.com/docs/k3s/latest/en/networking/