서비스 배포

Anthos Service Mesh를 사용하는 클러스터에 서비스를 배포하는 것은 Anthos Service Mesh가 없는 클러스터에 서비스를 배포하는 것과 거의 동일합니다. Kubernetes 매니페스트를 일부 변경해야 합니다.

  • 모든 컨테이너에 대해 Kubernetes 서비스를 만듭니다. 모든 배포에는 Kubernetes 서비스가 연결되어 있어야 합니다.

  • 서비스 포트의 이름을 지정합니다. GKE에서는 이름이 지정되지 않은 서비스 포트를 정의할 수 있지만, Anthos Service Mesh에서는 포트 프로토콜과 일치하는 포트 이름을 제공해야 합니다.

  • 배포에 라벨을 지정합니다. 이를 통해 동일한 서비스의 버전 간에 트래픽을 분할하는 등 Anthos Service Mesh 트래픽 관리 기능을 사용할 수 있습니다.

배포 및 서비스의 다음 예시는 이러한 요구사항을 보여줍니다.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: helloserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: helloserver
  template:
    metadata:
      labels:
        app: helloserver
    spec:
      containers:
      - image: gcr.io/google-samples/istio/helloserver:v0.0.1
        imagePullPolicy: Always
        name: main
      restartPolicy: Always
      terminationGracePeriodSeconds: 5
apiVersion: v1
kind: Service
metadata:
  name: hellosvc
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8080
  selector:
    app: helloserver
  type: LoadBalancer

Anthos Service Mesh를 사용하는 클러스터에 서비스를 배포한 후에는 사이드카 프록시를 삽입해야 합니다.

다음 단계