생성한 key pair pem 파일 통해 ssh 접속
devops 계정 생성 및 암호 설정
sudo useradd devops
sudo passwd devops
[ec2-user@ip-172-28-21-245 ~]$ sudo useradd devops
[ec2-user@ip-172-28-21-245 ~]$
[ec2-user@ip-172-28-21-245 ~]$
[ec2-user@ip-172-28-21-245 ~]$ sudo passwd devops
Changing password for user devops.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
eksctl download for unix 가이드 참고하여 진행
설치
# for ARM systems, set ARCH to: `arm64`, `armv6` or `armv7`
ARCH=amd64
PLATFORM=$(uname -s)_$ARCH
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
# (Optional) Verify checksum
curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
sudo mv /tmp/eksctl /usr/local/bin
확인
[devops@ip-172-28-21-245 ~]$ eksctl version
0.160.0
cluster, nodegroup 모두 clsuter.yaml 파일 하나로 관리
core nodegroup 과 ci nodegroup 분리
eksctl create cluster -f cluster.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: eks-devops-cluster-10
region: ap-northeast-2
version: "1.27"
vpc:
subnets:
private:
ap-northeast-2a:
id: {your-subnet-id-2a}
ap-northeast-2c:
id: {your-subnet-id-2c}
nat:
gateway: Disable
iam:
serviceRoleARN: {your-cluste-role-iam-arn}
privateCluster:
enabled: true
# additionalEndpointServices:
# For Cluster Autoscaler
# - "autoscaling"
# endpoint 기존에 존재 하기 때문에 스킵 ( 중복 안됨 )
skipEndpointCreation: true
managedNodeGroups:
- name: devops-core-nodegroup
instanceType: t3.large
instanceName: devops-core-nodegroup
desiredCapacity: 2
taints:
- key: devops.node-role
value: "core"
effect: NoExecute
ssh:
publicKeyName: devops-eks-nodegroup
privateNetworking: true
subnets: [{your-subnet-id-2a},{your-subnet-id-2c}]
labels: {
devops.role: core
}
iam:
instanceRoleARN: {your-nodegroup-iam-arn}
- name: devops-ci-nodegroup
instanceType: t3.large
instanceName: devops-ci-nodegroup
desiredCapacity: 2
ssh:
publicKeyName: devops-eks-nodegroup
privateNetworking: true
subnets: [{your-subnet-id-2a},{your-subnet-id-2c}]
labels: {
devops.role: worker,
devops.type: ci
}
iam:
instanceRoleARN: {your-nodegroup-iam-arn}