[Devops] istio 설치 후 Gateway, VirtualService 구성 하기
IT/DevOps

[Devops] istio 설치 후 Gateway, VirtualService 구성 하기

반응형

intro

istio를 설치 후에 쿠버네티스의 서비스(Service)와 연결하기위해 istio api를 사용하여 Gateway, Virtual Service를 생성해야합니다.

istio 아키텍처

service.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: web-api
    service: web-api
  name: web-api
  namespace: frontend
spec:
  ports:
    - port: 80
      name: http
      protocol: TCP
  selector:
    app: web-api

gateway.yaml

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: web-gateway
  namespace: frontend
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "web.kimdragon50.ml"
  - port:
      number: 443
      name: https
      protocol: HTTP
    hosts:
    - "web.kimdragon50.ml"

virtualservice.yaml

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: web-virtualservice
  namespace: frontend
spec:
  gateways:
  - web-gateway
  hosts:
  - "web.kimdragon50.ml"
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: web-api
        port:
          number: 80
반응형