devnoong.log
article thumbnail
728x90

AWS Fargate 란?

컨테이너에 적합한 서버리스 컴퓨팅 엔진으로 Amazon Elastic Container Service(ECS) 및 Amazon Elastic Kubernetes Service(EKS)에서 모두 작동합니다.

 

 Fargate에서는 서버를 프로비저닝하고 관리할 필요가 없어 애플리케이션별로 리소스를 지정하고 관련 비용을 지불할 수 있으며, 계획적으로 애플리케이션을 격리함으로써 보안 성능을 향상시킬 수 있습니다.

 

1.  fargate profile 정의하기

 

 fargate profile이란 fargate로 pod를 생성하기 위한 조건을 명시해놓은 프로파일입니다.

cat <<EOF> eks-demo-fargate-profile.yaml
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
  name: eks-demo-yh
  region: ${AWS_REGION}
fargateProfiles:
  - name: frontend-fargate-profile
    selectors:
      - namespace: default
        labels:
          app: frontend-fargate
EOF

2.  fargate profile 프로비저닝

fargate profile을 프로비저닝하도록 하겠습니다.

eksctl create fargateprofile -f eks-demo-fargate-profile.yaml

 

fargate profile이 정상적으로 생성되었는지 확인합니다.

eksctl get fargateprofile --cluster eks-demo-yh -o json

3.  기존 pod remove

프론트앤드 pod를 fargate로 프로비저닝 진행 하기 위해서 기존의 pod를 삭제하도록 하겠습니다.

kubectl delete -f frontend-deployment.yaml

4.   pod fargate 설정

label의 value 값이 demo-frontend에서 frontend-fargate로 변경되었음을 확인할 수 있습니다.

 

1번에서 key 값이 app이고 value 값이 frontend-fargate이며 namespace가 default일 때,

pod를 fargate로 배포하겠다는 조건을 맞추기 위해 frontend-deployment.yamlfrontend-service.yaml 파일 내용을 변경하겠습니다.

5.   매니페스트 배포

kubectl apply -f frontend-deployment.yaml
kubectl apply -f frontend-service.yaml

6.   프로비저닝 확인

kubectl get pod -o wide

echo http://$(kubectl get ingress/backend-ingress -o jsonpath='{.status.loadBalancer.ingress[*].hostname}')
728x90