이 가이드는 API 명세를 기반으로 자동 생성했습니다.
VPC 환경에서 이용 가능합니다.
Ncloud API 표준 규격을 적용한 API입니다.
클러스터에 Pod Identity 매핑을 생성합니다. 하나의 (namespace, serviceAccount)에는 Role 하나만 연결할 수 있으며, roleId는 클러스터 소유 계정의 활성 IAM Service Role 중 적용 대상 서비스가 Ncloud Kubernetes Service인 것이어야 합니다.
매핑이 동작하려면 클러스터에 Pod Identity 애드온이 설치되어 있어야 합니다(createAddon). 매핑에서 변경할 수 있는 값은 Role뿐이므로 변경 오퍼레이션은 제공하지 않습니다 — Role을 바꾸려면 매핑을 삭제한 뒤 다시 생성하십시오.
요청
요청 형식을 설명합니다. 요청 형식은 다음과 같습니다.
| 메서드 | URI |
|---|---|
| POST | /vnks/v3/clusters/{clusterId}/pod-identity-associations |
요청 헤더
Ncloud Kubernetes Service API에서 공통으로 사용하는 헤더에 대한 정보는 Ncloud Kubernetes Service 요청 헤더를 참조해 주십시오.
요청 경로 파라미터
요청 경로 파라미터에 대한 설명은 다음과 같습니다.
| 필드 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
clusterId |
String (uuid) | Required | 클러스터 ID (UUID)
|
요청 바디
요청 바디에 대한 설명은 다음과 같습니다.
| 필드 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
namespace |
String | Required | ServiceAccount의 네임스페이스 (DNS-1123 label)
|
serviceAccount |
String | Required | ServiceAccount 이름 (DNS-1123 subdomain). namespace와 합쳐 38자 이하여야 합니다.
|
roleId |
String | Required | 연결할 IAM Service Role의 ID. 클러스터 소유 계정의 활성 Role이며 적용 대상 서비스가 Ncloud Kubernetes Service여야 합니다.
|
요청 예시
요청 예시는 다음과 같습니다.
curl --location --request POST 'https://kr-nks.apigw.ntruss.com/vnks/v3/clusters/a1b2c3d4-e5f6-7890-abcd-ef1234567890/pod-identity-associations' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Content-Type: application/json' \
--data '{
"namespace": "default",
"serviceAccount": "my-app",
"roleId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
}'
응답
응답 형식을 설명합니다.
응답 헤더
응답 헤더에 대한 설명은 다음과 같습니다.
| 필드 | 필수 여부 | 설명 |
|---|---|---|
retry-after |
- | 재시도 권장 대기 시간(초) (429 응답) |
Ncloud Kubernetes Service API에서 공통으로 사용하는 헤더에 대한 정보는 Ncloud Kubernetes Service 응답 헤더를 참조해 주십시오.
응답 바디
응답 바디에 대한 설명은 다음과 같습니다.
| 필드 | 타입 | 필수 여부 | 설명 |
|---|---|---|---|
podIdentityAssociation |
Object | Required | Pod Identity 매핑
|
podIdentityAssociation.id |
String (uuid) | Required | id 값
|
podIdentityAssociation.clusterId |
String (uuid) | Required | 클러스터 UUID
|
podIdentityAssociation.namespace |
String | Required | ServiceAccount의 네임스페이스
|
podIdentityAssociation.serviceAccount |
String | Required | ServiceAccount 이름
|
podIdentityAssociation.roleId |
String | Required | 연결된 IAM Service Role의 ID
|
podIdentityAssociation.roleNrn |
String | Required | 연결된 IAM Service Role의 NRN
|
podIdentityAssociation.sourceIdentityId |
String | Required | 이 매핑으로 발급된 임시 자격 증명에 IAM이 기록하는 출처 식별자({clusterId}/{namespace}/{serviceAccount}). Role 정책의 조건으로 사용할 수 있습니다.
|
podIdentityAssociation.createdDateTime |
String (date-time) | Required | 생성 일시 (UTC)
|
응답 상태 코드
호출에 실패하면 기본 오류 응답 형식의 응답 바디를 반환하며, 오류 코드는 error.errorCode 값입니다.
응답 상태 코드에 대한 설명은 다음과 같습니다.
| HTTP 상태 코드 | 코드 | 메시지 | 설명 |
|---|---|---|---|
| 201 | - | - | Created |
| 400 | BadRequest |
The request is malformed or contains an error such as an invalid parameter value or a missing required parameter. |
요청을 해석할 수 없습니다 — 본문이 유효한 JSON이 아니거나 필수 항목이 빠진 경우입니다. 요청 형식을 확인한 뒤 다시 보내십시오. |
| 400 | InvalidParameter |
The specified parameter is invalid. |
요청 본문이 스키마·제약 조건을 위반했습니다. namespace·serviceAccount 형식(DNS-1123)·길이 제한(합계 38자), 또는 roleId가 조건(클러스터 소유 계정의 활성 Service Role, 적용 대상 서비스 Ncloud Kubernetes Service)에 맞지 않는 경우를 포함합니다. 필드별 사유는 error.fieldErrors에 담깁니다. 값을 고쳐 다시 요청하십시오. |
| 400 | InvalidState |
The request cannot be processed in the current state. |
클러스터가 삭제 중입니다. 삭제 중인 클러스터에는 이 요청을 처리할 수 없습니다. |
| 400 | PodIdentityAssociationLimitExceeded |
The pod identity association limit was exceeded. |
클러스터당 Pod Identity 매핑 수 상한(1,000개)을 넘었습니다. 쓰지 않는 매핑을 삭제한 뒤 다시 요청하십시오. |
| 403 | Forbidden |
You do not have sufficient permissions to perform this action. |
이 Action을 수행할 권한이 없습니다. 자원 존재 여부와 무관하게 권한 검사를 먼저 수행하므로 Sub Account 정책에 해당 Action 권한이 있는지 확인하십시오. |
| 404 | ClusterNotFound |
The cluster does not exist. |
지정한 클러스터가 없습니다. clusterId를 확인하십시오. |
| 409 | AlreadyExists |
A resource with the requested identifier already exists. |
같은 namespace·serviceAccount의 매핑이 이미 있습니다. Role을 바꾸려면 기존 매핑을 삭제한 뒤 다시 생성하십시오. |
| 415 | UnsupportedMediaType |
The content type of the request body is not supported. |
요청 Content-Type이 application/json이 아닙니다. Content-Type: application/json으로 다시 보내십시오. |
| 502 | BadGateway |
The server received an invalid response from an upstream service. Retry your request later. |
NKS 내부 처리 서비스나 연동 서비스(IAM)가 오류를 반환했습니다. 잠시 후 재시도하십시오. |
Ncloud Kubernetes Service API에서 공통으로 사용하는 응답 상태 코드에 대한 정보는 Ncloud Kubernetes Service 응답 상태 코드를 참조해 주십시오.
응답 예시
응답 예시는 다음과 같습니다.
{
"podIdentityAssociation": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"clusterId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"namespace": "default",
"serviceAccount": "my-app",
"roleId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"roleNrn": "nrn:PUB:IAM::1234567:Role/b2c3d4e5-f6a7-8901-bcde-f12345678901",
"sourceIdentityId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890/default/my-app",
"createdDateTime": "2026-02-24T10:00:00Z"
}
}