Kubernetes 역할 기반 액세스 제어 설정 - Amazon SageMaker AI

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

Kubernetes 역할 기반 액세스 제어 설정

또한 클러스터 관리자 사용자는 데이터 과학자가 SageMaker HyperPod CLI를 사용하여 Amazon EKS로 오케스트레이션된 HyperPod 클러스터에서 워크로드를 실행할 수 있도록 Kubernetes 역할 기반 액세스 제어(RBAC)를 설정해야 합니다.

옵션 1: Helm 차트를 사용하여 RBAC 설정

SageMaker HyperPod 서비스 팀은 RBAC를 설정하기 위한 헬름 하위 차트를 제공합니다. 자세한 내용은 헬름을 사용하여 Amazon EKS 클러스터에 패키지 설치을 참조하십시오.

옵션 2: RBAC 수동 설정

최소 권한으로 ClusterRoleClusterRoleBinding를 생성하고 돌연변이 권한으로 RoleRoleBinding를 생성합니다.

데이터 과학자 IAM 역할을 위해 ClusterRoleClusterRoleBinding 생성하기

다음과 같이 클러스터 수준 구성 파일 cluster_level_config.yaml을 생성합니다.

kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: hyperpod-scientist-user-cluster-role rules: - apiGroups: [""] resources: ["pods"] verbs: ["list"] - apiGroups: [""] resources: ["nodes"] verbs: ["list"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: hyperpod-scientist-user-cluster-role-binding subjects: - kind: Group name: hyperpod-scientist-user-cluster-level apiGroup: rbac.authorization.k8s.io roleRef: kind: ClusterRole name: hyperpod-scientist-user-cluster-role # this must match the name of the Role or ClusterRole you wish to bind to apiGroup: rbac.authorization.k8s.io

EKS 클러스터에 구성을 적용합니다.

kubectl apply -f cluster_level_config.yaml

네임스페이스에서 역할 및 RoleBinding을 생성하려면

이는 훈련 작업을 실행하는 네임스페이스 훈련 연산자이며 Resiliency는 기본적으로 모니터링합니다. 작업 자동 재개는 kubeflow 네임스페이스 또는 네임스페이스 접두사 aws-hyperpod에서만 지원할 수 있습니다.

다음과 같이 역할 구성 파일 namespace_level_role.yaml을 생성합니다. 이 예제는 kubeflow 네임스페이스에 역할을 생성합니다.

kind: Role apiVersion: rbac.authorization.k8s.io/v1 metadata: namespace: kubeflow name: hyperpod-scientist-user-namespace-level-role ### # 1) add/list/describe/delete pods # 2) get/list/watch/create/patch/update/delete/describe kubeflow pytroch job # 3) get pod log ### rules: - apiGroups: [""] resources: ["pods"] verbs: ["create", "get"] - apiGroups: [""] resources: ["nodes"] verbs: ["get", "list"] - apiGroups: [""] resources: ["pods/log"] verbs: ["get", "list"] - apiGroups: [""] resources: ["pods/exec"] verbs: ["get", "create"] - apiGroups: ["kubeflow.org"] resources: ["pytorchjobs", "pytorchjobs/status"] verbs: ["get", "list", "create", "delete", "update", "describe"] - apiGroups: [""] resources: ["configmaps"] verbs: ["create", "update", "get", "list", "delete"] - apiGroups: [""] resources: ["secrets"] verbs: ["create", "get", "list", "delete"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: namespace: kubeflow name: hyperpod-scientist-user-namespace-level-role-binding subjects: - kind: Group name: hyperpod-scientist-user-namespace-level apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: hyperpod-scientist-user-namespace-level-role # this must match the name of the Role or ClusterRole you wish to bind to apiGroup: rbac.authorization.k8s.io

EKS 클러스터에 구성을 적용합니다.

kubectl apply -f namespace_level_role.yaml

Kubernetes 그룹에 대한 액세스 항목 생성

위의 두 옵션 중 하나를 사용하여 RBAC를 설정한 후 필요한 정보를 대체하는 다음 샘플 명령을 사용합니다.

aws eks create-access-entry \ --cluster-name <eks-cluster-name> \ --principal-arn arn:aws:iam::<AWS_ACCOUNT_ID_SCIENTIST_USER>:role/ScientistUserRole \ --kubernetes-groups '["hyperpod-scientist-user-namespace-level","hyperpod-scientist-user-cluster-level"]'

principal-arn 파라미터의 경우 과학자용 IAM 사용자를 사용해야 합니다.