

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 노드 그룹 작업
<a name="general-nodegroups"></a>

## 노드 그룹 생성
<a name="_creating_nodegroups"></a>

클러스터와 함께 생성된 초기 노드 그룹 외에 하나 이상의 노드 그룹을 추가할 수 있습니다.

추가 노드 그룹을 생성하려면 다음을 사용합니다.

```
eksctl create nodegroup --cluster=<clusterName> [--name=<nodegroupName>]
```

**참고**  
 `--version` 관리형 노드 그룹에는 플래그가 지원되지 않습니다. 항상 컨트롤 플레인에서 버전을 상속합니다.

기본적으로 새 비관리형 노드 그룹은 컨트롤 플레인(`--version=auto`)에서 버전을 상속하지만 다른 버전을 지정할 수 있습니다. 또한 `--version=latest`를 사용하여 최신 버전을 강제로 사용할 수도 있습니다.

또한에 사용된 것과 동일한 구성 파일을 사용할 수 있습니다`eksctl create cluster`.

```
eksctl create nodegroup --config-file=<path>
```

### 구성 파일에서 노드 그룹 생성
<a name="_creating_a_nodegroup_from_a_config_file"></a>

노드 그룹은 클러스터 정의 또는 구성 파일을 통해 생성할 수도 있습니다. 다음 예제 구성 파일과 라는 기존 클러스터를 고려할 때`dev-cluster`:

```
# dev-cluster.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: dev-cluster
  region: eu-north-1

managedNodeGroups:
  - name: ng-1-workers
    labels: { role: workers }
    instanceType: m5.xlarge
    desiredCapacity: 10
    volumeSize: 80
    privateNetworking: true
  - name: ng-2-builders
    labels: { role: builders }
    instanceType: m5.2xlarge
    desiredCapacity: 2
    volumeSize: 100
    privateNetworking: true
```

노드 그룹 `ng-1-workers` 및는 다음 명령을 사용하여 생성할 `ng-2-builders` 수 있습니다.

```
eksctl create nodegroup --config-file=dev-cluster.yaml
```

#### 로드 밸런싱
<a name="_load_balancing"></a>

기존 클래식 로드 밸런서 또는 대상 그룹을 노드 그룹에 연결하기 위해 이미 준비한 경우 구성 파일에서 이를 지정할 수 있습니다. 클래식 로드 밸런서 또는 대상 그룹은 노드 그룹을 생성할 때 ASG와 자동으로 연결됩니다. 이는 `nodeGroups` 필드를 통해 정의된 자체 관리형 노드 그룹에 대해서만 지원됩니다.

```
# dev-cluster-with-lb.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: dev-cluster
  region: eu-north-1

nodeGroups:
  - name: ng-1-web
    labels: { role: web }
    instanceType: m5.xlarge
    desiredCapacity: 10
    privateNetworking: true
    classicLoadBalancerNames:
      - dev-clb-1
      - dev-clb-2
    asgMetricsCollection:
      - granularity: 1Minute
        metrics:
          - GroupMinSize
          - GroupMaxSize
          - GroupDesiredCapacity
          - GroupInServiceInstances
          - GroupPendingInstances
          - GroupStandbyInstances
          - GroupTerminatingInstances
          - GroupTotalInstances
  - name: ng-2-api
    labels: { role: api }
    instanceType: m5.2xlarge
    desiredCapacity: 2
    privateNetworking: true
    targetGroupARNs:
      - arn:aws:elasticloadbalancing:eu-north-1:01234567890:targetgroup/dev-target-group-1/abcdef0123456789
```

## 구성 파일의 노드 그룹 선택
<a name="_nodegroup_selection_in_config_files"></a>

구성 파일에 지정된 노드 그룹의 하위 집합에서만 `create` 또는 `delete` 작업을 수행하려면 globs 및 목록을 허용하는 CLI 플래그가 두 개 있습니다. `0` `1`예:

```
eksctl create nodegroup --config-file=<path> --include='ng-prod-*-??' --exclude='ng-test-1-ml-a,ng-test-2-?'
```

위의 예제 구성 파일을 사용하면 다음 명령을 사용하여 작업자를 제외한 모든 작업자 노드 그룹을 생성할 수 있습니다.

```
eksctl create nodegroup --config-file=dev-cluster.yaml --exclude=ng-1-workers
```

또는 다음을 사용하여 빌더 노드 그룹을 삭제할 수 있습니다.

```
eksctl delete nodegroup --config-file=dev-cluster.yaml --include=ng-2-builders --approve
```

이 경우 노드 그룹을 실제로 삭제하는 `--approve` 명령도 제공해야 합니다.

### 규칙 포함 및 제외
<a name="node-include"></a>
+ `--include` 또는 `--exclude`가 지정되지 않은 경우 모든 항목이 포함됩니다.
+ 만 `--include` 지정된 경우 해당 globs와 일치하는 노드 그룹만 포함됩니다.
+ 만 `--exclude` 지정된 경우 해당 globs와 일치하지 않는 모든 노드 그룹이 포함됩니다.
+ 둘 다 지정하면 `--exclude` 규칙이 우선합니다`--include`(즉, 두 그룹의 규칙과 일치하는 노드 그룹은 제외됨).

## 노드 그룹 나열
<a name="_listing_nodegroups"></a>

노드 그룹 또는 모든 노드 그룹에 대한 세부 정보를 나열하려면 다음을 사용합니다.

```
eksctl get nodegroup --cluster=<clusterName> [--name=<nodegroupName>]
```

기본 로그 테이블보다 더 많은 정보를 출력하는 YAML 또는 JSON 형식으로 하나 이상의 노드 그룹을 나열하려면 다음을 사용합니다.

```
# YAML format
eksctl get nodegroup --cluster=<clusterName> [--name=<nodegroupName>] --output=yaml

# JSON format
eksctl get nodegroup --cluster=<clusterName> [--name=<nodegroupName>] --output=json
```

## 노드 그룹 불변성
<a name="_nodegroup_immutability"></a>

설계상 노드 그룹은 변경할 수 없습니다. 즉, AMI 또는 노드 그룹의 인스턴스 유형과 같은 항목(스케일링 제외)을 변경해야 하는 경우 원하는 변경 사항이 있는 새 노드 그룹을 생성하고, 로드를 이동하고, 이전 노드 그룹을 삭제해야 합니다. [노드 그룹 삭제 및 드레이닝 섹션을 참조하세요](#nodegroup-delete).

## 노드 그룹 조정
<a name="_scaling_nodegroups"></a>

노드 그룹 조정은 최대 몇 분 정도 걸릴 수 있는 프로세스입니다. `--wait` 플래그를 지정하지 않으면 `eksctl`는 노드 그룹의 규모가 조정될 것으로 예상하고 AWS API 요청이 전송되는 즉시를 반환합니다. 노드를 사용할 수 있을 때까지 `eksctl` 기다리려면 아래 예제와 같은 `--wait` 플래그를 추가합니다.

**참고**  
ASG 변경에만 의존하므로 노드 그룹을 축소/축소(즉, 노드 수 감소)하면 오류가 발생할 수 있습니다. 즉, 제거/종료되는 노드(들)가 명시적으로 드레이닝되지 않습니다. 이는 향후 개선해야 할 영역일 수 있습니다.

관리형 노드 그룹 구성을 업데이트하는 EKS API를 직접 호출하여 관리형 노드 그룹을 확장할 수 있습니다.

### 단일 노드 그룹 조정
<a name="_scaling_a_single_nodegroup"></a>

다음 `eksctl scale nodegroup` 명령을 사용하여 노드 그룹을 확장할 수 있습니다.

```
eksctl scale nodegroup --cluster=<clusterName> --nodes=<desiredCount> --name=<nodegroupName> [ --nodes-min=<minSize> ] [ --nodes-max=<maxSize> ] --wait
```

예를 들어 노드 그룹을 `ng-a345f4e1`에서 5개의 노드`cluster-1`로 확장하려면 다음을 실행합니다.

```
eksctl scale nodegroup --cluster=cluster-1 --nodes=5 ng-a345f4e1
```

에 전달된 구성 파일을 사용하고 로 확장해야 하는 노드 그룹의 이름을 `--config-file` 지정하여 노드 그룹을 확장할 수도 있습니다`--name`. Eksctl은 구성 파일을 검색하고 해당 노드 그룹과 조정 구성 값을 검색합니다.

원하는 노드 수가 현재 최소 및 현재 최대 노드 수 범위 `NOT` 내에 있는 경우 특정 오류 하나가 표시됩니다. 이러한 값은 각각 플래그 `--nodes-min` 및와 함께 전달할 수도 `--nodes-max` 있습니다.

### 여러 노드 그룹 조정
<a name="_scaling_multiple_nodegroups"></a>

Eksctl은와 함께 전달되는 구성 파일에 있는 모든 노드 그룹을 검색하고 확장할 수 있습니다`--config-file`.

단일 노드 그룹을 조정하는 것과 마찬가지로 각 노드 그룹에도 동일한 검증 세트가 적용됩니다. 예를 들어 원하는 노드 수는 최소 및 최대 노드 수 범위 내에 있어야 합니다.

## 노드 그룹 삭제 및 드레이닝
<a name="nodegroup-delete"></a>

노드 그룹을 삭제하려면 다음을 실행합니다.

```
eksctl delete nodegroup --cluster=<clusterName> --name=<nodegroupName>
```

 [포함 및 제외 규칙](#node-include)은이 명령과 함께 사용할 수도 있습니다.

**참고**  
그러면 인스턴스가 삭제되기 전에 해당 노드 그룹에서 모든 포드가 드레이닝됩니다.

드레이닝 프로세스 중에 제거 규칙을 건너뛰려면 다음을 실행합니다.

```
eksctl delete nodegroup --cluster=<clusterName> --name=<nodegroupName> --disable-eviction
```

모든 노드가 연결되고 삭제 시 노드 그룹에서 모든 포드가 제거되지만 노드 그룹을 삭제하지 않고 드레이닝해야 하는 경우 다음을 실행합니다.

```
eksctl drain nodegroup --cluster=<clusterName> --name=<nodegroupName>
```

노드 그룹의 코딩을 해제하려면 다음을 실행합니다.

```
eksctl drain nodegroup --cluster=<clusterName> --name=<nodegroupName> --undo
```

PodDisruptionBudget 설정과 같은 제거 규칙을 무시하려면 다음을 실행합니다.

```
eksctl drain nodegroup --cluster=<clusterName> --name=<nodegroupName> --disable-eviction
```

드레이닝 프로세스의 속도를 높이려면 병렬`--parallel <value>`로 드레이닝할 노드 수를 지정할 수 있습니다.

## 기타 기능
<a name="_other_features"></a>

노드 그룹에 대해 SSH, ASG 액세스 및 기타 기능을 활성화할 수도 있습니다. 예:

```
eksctl create nodegroup --cluster=cluster-1 --node-labels="autoscaling=enabled,purpose=ci-worker" --asg-access --full-ecr-access --ssh-access
```

### 레이블 업데이트
<a name="_update_labels"></a>

에는 노드 그룹의 레이블을 업데이트`eksctl`하는 특정 명령이 없지만 `kubectl`를 사용하여 쉽게 수행할 수 있습니다. 예:

```
kubectl label nodes -l alpha.eksctl.io/nodegroup-name=ng-1 new-label=foo
```

### SSH 액세스
<a name="_ssh_access"></a>

노드 그룹 구성`publicKeyPath`에서 `publicKey` `publicKeyName` 및 중 하나를 구성하여 노드 그룹에 대한 SSH 액세스를 활성화할 수 있습니다. 또는 `enableSsm`로 노드 그룹을 구성하여 [AWS Systems Manager(SSM)](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html#sessions-start-cli)를 사용하여 노드에 SSH를 적용할 수 있습니다.

```
managedNodeGroups:
  - name: ng-1
    instanceType: m5.large
    desiredCapacity: 1
    ssh: # import public key from file
      publicKeyPath: ~/.ssh/id_rsa_tests.pub
  - name: ng-2
    instanceType: m5.large
    desiredCapacity: 1
    ssh: # use existing EC2 key
      publicKeyName: ec2_dev_key
  - name: ng-3
    instanceType: m5.large
    desiredCapacity: 1
    ssh: # import inline public key
      publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqZEdzvHnK/GVP8nLngRHu/GDi/3PeES7+Bx6l3koXn/Oi/UmM9/jcW5XGziZ/oe1cPJ777eZV7muEvXg5ZMQBrYxUtYCdvd8Rt6DIoSqDLsIPqbuuNlQoBHq/PU2IjpWnp/wrJQXMk94IIrGjY8QHfCnpuMENCucVaifgAhwyeyuO5KiqUmD8E0RmcsotHKBV9X8H5eqLXd8zMQaPl+Ub7j5PG+9KftQu0F/QhdFvpSLsHaxvBzA5nhIltjkaFcwGQnD1rpCM3+UnQE7Izoa5Yt1xoUWRwnF+L2TKovW7+bYQ1kxsuuiX149jXTCJDVjkYCqi7HkrXYqcC1sbsror someuser@hostname"
  - name: ng-4
    instanceType: m5.large
    desiredCapacity: 1
    ssh: # enable SSH using SSM
      enableSsm: true
```