본 블로그 게시물은 가시다 님(CloudNet@ 팀)이 진행하는 AWS EKS Workshop Study (=AEWS)2기에 참여하며 작성한 글입니다.
1. Amazon EKS 소개
- Amazon docs 참조 : 링크
Amazon EKS란 무엇입니까? - Amazon EKS
Amazon EKS란 무엇입니까? Amazon Elastic Kubernetes Service(Amazon EKS)는 Amazon Web Services(AWS)에 Kubernetes 컨트롤 플레인을 설치, 운영 및 유지 관리할 필요가 없는 관리형 서비스입니다. Kubernetes는 컨테이너
docs.aws.amazon.com
- 기능 참조 : 링크
관리형 Kubernetes 서비스 - Amazon EKS 기능 - Amazon Web Services
aws.amazon.com
- workshop studio 참조 : 링크
Amazon EKS web application workshop
Building simple web application using Amazon EKS. This workshop covers from creating eks cluster to application's life cycle.
catalog.us-east-1.prod.workshops.aws
- K8S vs EKS
- Kubernetes - |
- EKS - |
- Amazon Elastic Kubernetes Service는 자체 Kubernetes 컨트롤 플레인 또는 노드를 설치, 운영 및 유지 관리할 필요 없이 Kubernetes 실행에 사용할 수 있는 관리형 서비스
- 여러 AWS 가용 영역에 걸쳐 Kubernetes 컨트롤 플레인을 실행하고 크기를 조정하여 높은 가용성을 보장
- 컨트롤 플레인은 제어 영역 인스턴스의 크기를 자동으로 조정하고, 비정상 제어 영역 인스턴스를 감지하고 교체하며, 자동화된 버전 업데이트 및 패치를 제공
- 여러 AWS 서비스와 통합 : 컨테이너 이미지 저장소 Amazon ECR, 로드 분산을 위한 ELB, 인증 IAM, 격리를 위한 Amazon VPC
- 오픈 소스 Kubernetes 소프트웨어의 최신 버전을 실행하므로 Kubernetes 커뮤니티에서 모든 기존 플러그 인과 도구를 사용할 수 있습니다. 필요한 코드를 수정하지 않고 표준 Kubernetes 애플리케이션을 Amazon EKS로 쉽게 마이그레이션할 수 있습니다.
- 지원 버전 : 보통 5~6개의 마이너 버전 지원(현재 1.25~1.29), 평균 3개월마다 새 버전 제공, 처음 14개월 지원, 추가 12개월 연장 지원(비용 추가) - 링크
- v1.25.Y → Major.Minor.Patch ⇒ Major(Breaking Changes) . Minor(New Features) . Patch(Bug fixes Security)
- EKS 아키텍처
- EKS 컨트롤 플레인 : AWS Managed VPC - 3개 AZ, API NLB, ETCD ELB - 링크
ETCD는 무엇일까요?
>>> 분산 시스템을 계속 실행하는 데 필요한 중요한 정보를 보관하고 관리하는 데 사용되는 분산 오픈소스 키-값 저장소
API 부하분산을 ALB가 아닌 NLB를 사용하는 이유는?
>>> 속도 측면이 아닐까 추측해본다.
- EKS 데이터 플레인 : Customer VPC - EKS owned ENI?, 노드 유형(Managed node groups, Self-managed nodes, AWS Fargate) - 링크
Amazon EKS nodes - Amazon EKS
Nodes must be in the same VPC as the subnets you selected when you created the cluster. However, the nodes don't have to be in the same subnets.
docs.aws.amazon.com
- Managed node groups (관리형 노드 그룹) : 최신 EKS Optimized AMI를 사용 - 링크, AWS에서 AMI 관리, Capacity(On-Demand, Spot) - 링크
- Bottlerocket, A Year in the Life - 링크
<aside> ❓ EKS 관리형 노드 그룹 사용 시, Spot 인스턴스를 사용하고 계신가요? 비용 절감 결과나 주의사항이 있나요?
</aside>
- Self-managed nodes : Custom AMI를 사용, ASG 직접 관리, OS 기본구성/패치를 고객이 직접 관리 - 링크
- AWS Fargate (서버리스) : 고객은 별도의 EC2관리할 필요 없이, AWS Fargate 환경에서 제공하는 Micro VM을 이용하여 Pod 별 VM 할당 - 링크
AWS Fargate - Amazon EKS
AWS Fargate AWS Fargate with Amazon EKS isn't available in AWS GovCloud (US-East) and AWS GovCloud (US-West). This topic discusses using Amazon EKS to run Kubernetes Pods on AWS Fargate. Fargate is a technology that provides on-demand, right-sized compute
docs.aws.amazon.com
[심화 내용] 카타 컨테이너 (Kata Container)
- 카타 컨테이너란?
- 컨테이너 처럼 느껴지게 작동하는 경량 VM으로 HW 를 통한 강력한 workload 격리로 안전한 컨테이너를 제공하는 기술
- 특징 : 보안(개별적인 전용 kernel), 분리된 (Network I/O Memory) 제공 → 하드웨어 강제격리 제공, VM처럼 성능의 소모 없이 분리된 환경을 제공
- 지원하는 하이퍼바이저 : qemu, cloud-hypervisor, firecracker, ACRN - 링크
- 카타 컨테이너 아키텍처 - 링크


- 카타 컨테이너 환경 vs 기존의 일반 컨테이너 환경

- EKS Cluster Endpoint - Public : 제어부 → (EKS owned ENI) 워커노드 kubelet, 워커노드 → (퍼블릭 도메인) 제어부, 사용자 kubectl → (퍼블릭 도메인) 제어부
- EKS Cluster Endpoint - Public Private : 제어부 → (EKS owned ENI) 워커노드 kubelet, 워커노드 → (프라이빗 도메인, EKS owned ENI) 제어부, 사용자 kubectl → (퍼블릭 도메인) 제어부
- EKS Cluster Endpoint - Private : 제어부 → (EKS owned ENI) 워커노드 kubelet, 워커노드,사용자 kubectl → (프라이빗 도메인, EKS owned ENI) 제어부
kubectl exec 나 logs 명령 실행 시 요청과 실행 과정의 flow는 어떻게 될까요? -Link
Communication between Nodes and the Control Plane
This document catalogs the communication paths between the API server and the Kubernetes cluster. The intent is to allow users to customize their installation to harden the network configuration such that the cluster can be run on an untrusted network (or
kubernetes.io
- EKS 배포 방식 : 웹 관리 콘솔 - 링크, eksctl, IaC(CDK, CloudFormation, Terraform 등)
// NewStackCollection creates a stack manager for a single cluster
func NewStackCollection(provider api.ClusterProvider, spec *api.ClusterConfig) StackManager {
tags := []types.Tag{
newTag(api.ClusterNameTag, spec.Metadata.Name),
newTag(api.OldClusterNameTag, spec.Metadata.Name),
newTag(api.EksctlVersionTag, version.GetVersion()),
}
for key, value := range spec.Metadata.Tags {
tags = append(tags, newTag(key, value))
}
return &StackCollection{
spec: spec,
sharedTags: tags,
cloudformationAPI: provider.CloudFormation(),
ec2API: provider.EC2(),
eksAPI: provider.EKS(),
iamAPI: provider.IAM(),
cloudTrailAPI: provider.CloudTrail(),
asgAPI: provider.ASG(),
disableRollback: provider.CloudFormationDisableRollback(),
roleARN: provider.CloudFormationRoleARN(),
region: provider.Region(),
waitTimeout: provider.WaitTimeout(),
}
}
// DoCreateStackRequest requests the creation of a CloudFormation stack
func (c *StackCollection) DoCreateStackRequest(ctx context.Context, i *Stack, templateData TemplateData, tags, parameters map[string]string, withIAM bool, withNamedIAM bool) error {
input := &cloudformation.CreateStackInput{
StackName: i.StackName,
DisableRollback: aws.Bool(c.disableRollback),
}
input.Tags = append(input.Tags, c.sharedTags...)
for k, v := range tags {
input.Tags = append(input.Tags, newTag(k, v))
}
switch data := templateData.(type) {
case TemplateBody:
input.TemplateBody = aws.String(string(data))
case TemplateURL:
input.TemplateURL = aws.String(string(data))
default:
return fmt.Errorf("unknown template data type: %T", templateData)
}
if withIAM {
input.Capabilities = stackCapabilitiesIAM
}
if withNamedIAM {
input.Capabilities = stackCapabilitiesNamedIAM
}
if cfnRole := c.roleARN; cfnRole != "" {
input.RoleARN = aws.String(cfnRole)
}
for k, v := range parameters {
input.Parameters = append(input.Parameters, types.Parameter{
ParameterKey: aws.String(k),
ParameterValue: aws.String(v),
})
}
logger.Debug("CreateStackInput = %#v", input)
s, err := c.cloudformationAPI.CreateStack(ctx, input)
if err != nil {
return errors.Wrapf(err, "creating CloudFormation stack %q", *i.StackName)
}
i.StackId = s.StackId
return nil
}
- Terraform 배포 - Link.
- (심화) AWS re:Invent 2019: Amazon EKS under the hood (CON421-R1) - 링크 PDF
- 실제로 EKS Control Plane 역시 여러 AWS 서비스들의 조합으로 구성되어 있다.
'AWS > EKS' 카테고리의 다른 글
1주차 (3/3) 도전편 - Amazon EKS 1주차 도전과제 (0) | 2024.03.09 |
---|---|
1주차 (2/3) 실습편 - Amazon EKS 직접 처음부터 배포해보기 (0) | 2024.03.09 |