Amazon ECS 배포 전략 업데이트 문제 해결

Amazon ECS 배포 전략 업데이트 문제 해결

이 섹션은 배포 전략을 마이그레이션할 때 겪을 수 있는 일반적인 문제에 대한 해결책을 제공해요.

출처: 문서

본문

여러 서비스 개정 또는 태스크 세트 (Multiple service revisions or task sets)

다음 문제는 배포에 여러 서비스 개정이 있는 것과 관련돼요.

ECS 배포 컨트롤러를 업데이트할 때 여러 태스크 세트

  • 오류 메시지: Updating the deployment controller is not supported when there are multiple tasksets in the service. Please ensure your service has only one taskset and try again.

  • 해결책: 이 오류는 여러 활성 태스크 세트가 있는 서비스의 배포 컨트롤러 유형을 변경하려 할 때 발생해요. CODE_DEPLOY 또는 EXTERNAL 배포 컨트롤러에 대해 이 문제를 해결하려면:

    1. 현재 태스크 세트를 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].taskSets"
    
    1. 진행 중인 배포가 완료될 때까지 기다립니다.
    2. 태스크 세트를 정리하기 위해 새 배포를 강제합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --force-new-deployment
    
    1. 필요한 경우 추가 태스크 세트를 수동으로 삭제합니다.
    aws ecs delete-task-set --cluster your-cluster-name --service your-service-name --task-set task-set-id
    
    1. 태스크 세트가 하나만 남은 후 배포 컨트롤러 업데이트를 다시 시도합니다.

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

ECS 배포 컨트롤러를 업데이트할 때 기본 태스크 세트 누락

  • 오류 메시지: Updating the deployment controller requires a primary taskset in the service. Please ensure your service has a primary taskset and try again.

  • 해결책: 이 오류는 기본 태스크 세트가 없는 서비스의 배포 컨트롤러 유형을 변경하려 할 때 발생해요. 이 문제를 해결하려면:

    1. 서비스 상태와 태스크 세트를 확인합니다. 서비스에 태스크 세트가 존재한다면 ACTIVE로 표시되어야 해요.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].taskSets[*].[status,id]
    
    1. ACTIVE 상태의 태스크 세트가 없다면 배포를 마이그레이션합니다. 자세한 내용은 Migration approaches를 참고하세요.
    2. 서비스에 실행 중인 태스크가 없다면 서비스를 업데이트해 태스크를 하나 이상 배포합니다.
    aws ecs update-service-primary-task-set --cluster your-cluster-name --service your-service-name --primary-task-set your-taskset-id
    

    이는 서비스의 (이전에 ACTIVE였던) 태스크 세트를 PRIMARY 상태로 표시합니다. 4. 태스크가 안정적인 실행 상태에 도달할 때까지 기다립니다. 다음으로 상태를 확인할 수 있어요.

    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].deployments"
    
    1. 서비스에 실행 중인 태스크가 있는 기본 태스크 세트가 생긴 후 배포 컨트롤러 업데이트를 다시 시도합니다.

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

배포 실패 감지 유형과 배포 컨트롤러 간 불일치

다음 문제는 배포 실패 감지 유형과 배포 컨트롤러 간의 불일치와 관련돼요.

비-ECS 컨트롤러와 함께 배포 회로 차단기

  • 오류 메시지: Deployment circuit breaker feature is only supported with ECS deployment controller. Update to ECS deployment controller and try again.

  • 해결책: 이 오류는 ECS 배포 컨트롤러를 사용하지 않는 서비스에서 배포 회로 차단기 기능을 활성화하려 할 때 발생해요. 배포 회로 차단기는 ECS 배포 컨트롤러와만 호환돼요.

    1. 서비스의 현재 배포 컨트롤러를 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].deploymentController"
    
    1. 서비스를 ECS 배포 컨트롤러를 사용하도록 업데이트합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-controller type=ECS
    
    1. 서비스가 ECS 배포 컨트롤러를 사용한 후 배포 회로 차단기를 활성화합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-configuration "deploymentCircuitBreaker={enable=true,rollback=true}"
    

자세한 내용은 How the Amazon ECS deployment circuit breaker detects failures를 참고하세요.

비-ECS 컨트롤러와 함께 알람 기반 롤백

  • 오류 메시지: Alarm based rollback feature is only supported with ECS deployment controller. Update to ECS deployment controller and try again.

  • 해결책: 이 오류는 ECS 배포 컨트롤러를 사용하지 않는 서비스에서 알람 기반 롤백을 구성하려 할 때 발생해요. 알람 기반 롤백 기능은 ECS 배포 컨트롤러와만 호환돼요.

    1. 서비스의 현재 배포 컨트롤러를 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].deploymentController"
    
    1. 서비스를 ECS 배포 컨트롤러를 사용하도록 업데이트합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-controller type=ECS
    
    1. 서비스가 ECS 배포 컨트롤러를 사용한 후 알람 기반 롤백을 구성합니다.
    aws ecs update-service --cluster your-cluster-name --services your-service-name --deployment-configuration "alarms={alarmNames=[your-alarm-name],enable=true,rollback=true}"
    

자세한 내용은 How CloudWatch alarms detect Amazon ECS deployment failures를 참고하세요.

Service Connect와 배포 컨트롤러 간 불일치

다음 문제는 Service Connect와 배포 컨트롤러 간의 불일치와 관련돼요.

Service Connect와 함께 EXTERNAL 컨트롤러

  • 오류 메시지: The EXTERNAL deployment controller type is not supported for services using Service Connect.

  • 해결책: 이 오류는 Service Connect가 활성화된 서비스에서 EXTERNAL 배포 컨트롤러를 사용하려 할 때 발생해요. EXTERNAL 컨트롤러는 Service Connect와 호환되지 않아요.

    1. 서비스에 Service Connect가 활성화되어 있는지 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].serviceConnectConfiguration"
    
    1. EXTERNAL 배포 컨트롤러를 사용해야 한다면 서비스를 업데이트해 Service Connect를 비활성화합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --service-connect-configuration "{}"
    
    1. 또는 Service Connect를 사용해야 한다면 대신 ECS 배포 컨트롤러를 사용합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-controller type=ECS
    

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

비-ECS 컨트롤러와 함께 Service Connect

  • 오류 메시지: Service Connect feature is only supported with ECS (rolling update) deployment controller. Update to ECS deployment controller and try again.

  • 해결책: 이 오류는 ECS 배포 컨트롤러를 사용하지 않는 서비스에서 Service Connect를 활성화하려 할 때 발생해요. Service Connect 기능은 ECS 배포 컨트롤러와만 호환돼요.

    1. 서비스의 현재 배포 컨트롤러를 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].deploymentController"
    
    1. 서비스를 ECS 배포 컨트롤러를 사용하도록 업데이트합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-controller type=ECS
    
    1. 서비스가 ECS 배포 컨트롤러를 사용한 후 Service Connect를 활성화합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --service-connect-configuration "enabled=true,namespace=your-namespace"
    

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

컨트롤러 유형과 스케줄링 전략 간 불일치

다음 문제는 컨트롤러 유형과 스케줄링 전략 간의 불일치와 관련돼요.

DAEMON 스케줄링 전략과 함께 CODE_DEPLOY 컨트롤러

  • 오류 메시지: The CODE_DEPLOY deployment controller type is not supported for services using the DAEMON scheduling strategy.

  • 해결책: 이 오류는 DAEMON 스케줄링 전략을 사용하는 서비스에서 CODE_DEPLOY 배포 컨트롤러를 사용하려 할 때 발생해요. CODE_DEPLOY 컨트롤러는 REPLICA 스케줄링 전략과만 호환돼요.

    1. 서비스의 현재 스케줄링 전략을 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].schedulingStrategy"
    
    1. 블루/그린 배포가 필요하다면 서비스를 REPLICA 스케줄링 전략을 사용하도록 변경합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --scheduling-strategy REPLICA
    
    1. 또는 DAEMON 스케줄링 전략을 사용해야 한다면 대신 ECS 배포 컨트롤러를 사용합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-controller type=ECS
    

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

DAEMON 스케줄링 전략과 함께 EXTERNAL 컨트롤러

  • 오류 메시지: The EXTERNAL deployment controller type is not supported for services using the DAEMON scheduling strategy.

  • 해결책: 이 오류는 DAEMON 스케줄링 전략을 사용하는 ECS 서비스에서 EXTERNAL 배포 컨트롤러를 사용하려 할 때 발생해요. EXTERNAL 컨트롤러는 REPLICA 스케줄링 전략과만 호환돼요.

    1. 서비스의 현재 스케줄링 전략을 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].schedulingStrategy"
    
    1. EXTERNAL 배포 컨트롤러를 사용해야 한다면 서비스를 REPLICA 스케줄링 전략을 사용하도록 변경합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --scheduling-strategy REPLICA
    
    1. 또는 DAEMON 스케줄링 전략을 사용해야 한다면 대신 ECS 배포 컨트롤러를 사용합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --deployment-controller type=ECS
    

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

외부 실행 유형과 서비스 레지스트리 (Service registries with external launch type)

  • 오류 메시지: Service registries are not supported for external launch type.

  • 해결책: 이 오류는 EXTERNAL 실행 유형을 사용하는 서비스에 대해 서비스 검색(서비스 레지스트리)을 구성하려 할 때 발생해요. 서비스 검색은 EXTERNAL 실행 유형과 호환되지 않아요.

    1. 서비스의 현재 실행 유형을 확인합니다.
    aws ecs describe-services --cluster your-cluster-name --services your-service-name --query "services[0].launchType"
    
    1. 서비스 검색이 필요하다면 서비스를 EC2 또는 FARGATE 실행 유형을 사용하도록 변경합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --launch-type FARGATE
    
    1. 또는 EXTERNAL 실행 유형을 사용해야 한다면 서비스 레지스트리 구성을 제거합니다.
    aws ecs update-service --cluster your-cluster-name --service your-service-name --service-registries "[]"
    

자세한 내용은 Amazon ECS service deployment controllers and strategies를 참고하세요.

배포 컨트롤러 업데이트 되돌리기 (Revert a deployment controller update)

이전 배포 컨트롤러로 돌아가기로 결정했다면 다음 중 하나를 수행할 수 있어요.

  • CloudFormation을 사용했다면 이전 템플릿을 사용해 새 스택을 만들 수 있어요. 자세한 내용은 CloudFormation User Guide의 Create a stack from을 참고하세요.
  • Amazon ECS 콘솔 또는 AWS CLI를 사용했다면 서비스를 업데이트할 수 있어요. 자세한 내용은 Updating an Amazon ECS service를 참고하세요. update-service 명령을 사용한다면 --deployment-controller 옵션을 사용해 이전 배포 컨트롤러로 설정하세요.