ekstctl
eksctl create cluster --name=<cluster-name> --enable-auto-mode
Shell
복사
cluster.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: <cluster-name>
region: <aws-region>
iam:
# ARN of the Cluster IAM Role
# optional, eksctl creates a new role if not supplied
# suggested to use one Cluster IAM Role per account
serviceRoleARN: <arn-cluster-iam-role>
autoModeConfig:
# defaults to false
enabled: boolean
# optional, defaults to [general-purpose, system].
# suggested to leave unspecified
# To disable creation of nodePools, set it to the empty array ([]).
nodePools: []string
# optional, eksctl creates a new role if this is not supplied
# and nodePools are present.
nodeRoleARN: string
YAML
복사
enabled
이 속성은 자동 모드를 활성화할지 여부를 결정합니다. true로 설정하면 자동 모드가 활성화되고, false로 설정하면 비활성화됩니다. 기본값은 false입니다.
nodePools
이 속성은 자동으로 생성될 노드 풀의 유형을 지정합니다. 기본값은 [general-purpose, system]입니다. 이 속성을 빈 배열([])로 설정하면 노드 풀이 생성되지 않습니다.
nodeRoleARN
이 속성은 노드 풀에 대한 IAM 역할의 ARN을 지정합니다. 이 값이 제공되지 않으면 eksctl이 노드 풀이 존재할 경우 새 역할을 생성합니다.
cat << EOF > node-trust-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
EOF
Shell
복사
aws iam create-role \
--role-name EKSNodeRole \
--assume-role-policy-document file://node-trust-policy.json
Shell
복사
aws iam attach-role-policy \
--role-name EKSNodeRole \
--policy-arn arn:aws:iam::aws:policy/AmazonEKSWorkerNodePolicy
aws iam attach-role-policy \
--role-name EKSNodeRole \
--policy-arn arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
aws iam attach-role-policy \
--role-name EKSNodeRole \
--policy-arn arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy
Shell
복사
aws iam get-role --role-name EKSNodeRole --query 'Role.Arn' --output text
Shell
복사