

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 將 JEG Pod 部署到節點群組
<a name="managed-endpoint-nodegroups-setup"></a>

JEG (Jupyter Enterprise Gateway) Pod 放置是一項功能，可讓您在特定節點群組上部署互動端點。使用此功能，可以設定互動端點的設定，例如 `instance type`。

## 將 JEG Pod 關聯至受管節點群組
<a name="associate-jegpod-to-nodegroup"></a>

下列組態屬性可讓您指定要部署 JEG Pod 之 Amazon EKS 叢集上的受管節點群組名稱。

```
//payload 
--configuration-overrides '{
      "applicationConfiguration": [
            {
                "classification": "endpoint-configuration",
                "properties": {
                    "managed-nodegroup-name": NodeGroupName
                }        
            }
        ] 
    }'
```

節點群組必須已將 Kubernetes 標籤 `for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName` 附接至屬於節點群組的所有節點。若要列出節點群組中擁有此標籤的所有節點，請使用下列命令：

```
kubectl get nodes --show-labels | grep for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName
```

如果上述命令輸出未傳回屬於受管節點群組的節點，則節點群組中沒有附接 `for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName` Kubernetes 標籤的節點。在這種情況下，遵循以下步驟將標籤附接至節點群組中的節點。

1. 使用下列命令，將 `for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName` Kubernetes 標籤新增至受管節點群組 `NodeGroupName` 中的所有節點：

   ```
   kubectl label nodes --selector eks:nodegroup-name=NodeGroupName for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName
   ```

1. 使用下列命令，確認已正確標記節點：

   ```
   kubectl get nodes --show-labels | grep for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName
   ```

受管節點群組必須與 Amazon EKS 叢集的安全群組相關聯，這通常發生在您使用 `eksctl` 建立叢集和受管節點群組時。您可以使用下列步驟在 AWS 主控台中驗證此項目。

1. 轉至 Amazon EKS 主控台中的叢集。

1. 轉至叢集的「聯網」索引標籤，並記下叢集安全群組。

1. 轉至叢集的「運算」索引標籤，然後按一下受管節點群組名稱。

1. 在受管節點群組的**詳細資訊**索引標籤下，確認您先前記下的叢集安全群組列在**安全群組**下。

如果受管節點群組未附接至 Amazon EKS 叢集安全群組，則需要將 `for-use-with-emr-containers-managed-endpoint-sg=ClusterName/NodeGroupName` 標籤附接至節點群組安全群組。使用下列步驟來附接此標籤。

1. 轉至 Amazon EC2 主控台並按一下左側導覽窗格中的安全群組。

1. 按一下核取方塊，選取受管節點群組的安全群組。

1. 在**標籤**索引標籤下，使用**管理標籤**按鈕新增標籤 `for-use-with-emr-containers-managed-endpoint-sg=ClusterName/NodeGroupName`。

## 將 JEG Pod 關聯至自我管理節點群組
<a name="associate-jegpod-to-self-managed-nodegroup"></a>

下列組態屬性可讓您指定要部署 JEG Pod 之 Amazon EKS 叢集上的自我管理或未受管節點群組名稱。

```
//payload 
--configuration-overrides '{
      "applicationConfiguration": [
            {
                "classification": "endpoint-configuration",
                "properties": {
                    "self-managed-nodegroup-name": NodeGroupName
                }        
            }
        ] 
    }'
```

節點群組必須已將 `for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName` Kubernetes 標籤附接至屬於節點群組的所有節點。若要列出節點群組中擁有此標籤的所有節點，請使用下列命令：

```
kubectl get nodes --show-labels | grep for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName
```

如果上述命令輸出未傳回屬於自我管理節點群組的節點，則節點群組中沒有附接 `for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName` Kubernetes 標籤的節點。在這種情況下，遵循以下步驟將標籤附接至節點群組中的節點。

1. 如果使用 `eksctl` 建立自我管理節點群組，請使用下列命令將 `for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName` Kubernetes 標籤一次新增至自我管理節點群組 `NodeGroupName` 中的所有節點。

   ```
   kubectl label nodes --selector alpha.eksctl.io/nodegroup-name=NodeGroupName for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName
   ```

   如果您未使用 `eksctl` 建立自我管理節點群組，則需要將上述命令中的選取器取代為附接至節點群組中所有節點的不同 Kubernetes 標籤。

1. 使用下列命令，確認已正確標記節點：

   ```
   kubectl get nodes --show-labels | grep for-use-with-emr-containers-managed-endpoint-ng=NodeGroupName
   ```

自我管理節點群組的安全群組必須已附接 `for-use-with-emr-containers-managed-endpoint-sg=ClusterName/NodeGroupName` 標籤。使用下列步驟將標籤從 AWS 管理主控台中附接至安全群組。

1. 導覽至 Amazon EC2 主控台。在左側導覽窗格中，選取**安全群組**。

1. 選取自我管理節點群組中安全群組旁邊的核取方塊。

1. 在**標籤**索引標籤下，使用**管理標籤**按鈕新增標籤 `for-use-with-emr-containers-managed-endpoint-sg=ClusterName/NodeGroupName`。用適當的值取代 `ClusterName` 和 `NodeGroupName`。

## 將 JEG Pod 關聯至具有隨需執行個體的受管節點群組
<a name="associate-jegpod-to-on-demand-instances"></a>

也可以定義其他標籤 (稱為 *Kubernetes 標籤選取器*)，以指定其他約束或限制，以便在指定節點或節點群組上執行互動端點。以下範例說明如何將隨需 Amazon EC2 執行個體用於 JEG Pod。

```
--configuration-overrides '{
      "applicationConfiguration": [
            {
                "classification": "endpoint-configuration",
                "properties": {
                    "managed-nodegroup-name": NodeGroupName,
                    "node-labels": "eks.amazonaws.com/capacityType:ON_DEMAND"
                }        
            }
        ] 
    }'
```

**注意**  
只能將 `node-labels` 屬性與 `managed-nodegroup-name` 或 `self-managed-nodegroup-name` 屬性搭配使用。