쿠버네티스 API 동사

(쿠버네티스 API 요청 동사에서 넘어옴)

1 개요[ | ]

Kubernetes API Request Verb, k8s API verbs
쿠버네티스 API 요청 동사, 쿠버네티스 API 동사
get, list, create, update, patch, watch, proxy, redirect, delete, deletecollection
CRUD 구분 K8s API Verb 설명 HTTP Method & Path kubectl 예시
Create (생성) create 새 리소스 생성 POST /resource kubectl create -f pod.yaml
Read (조회) get 단일 리소스 조회 GET /resource/{name} kubectl get pod mypod
list 리소스 목록 조회 GET /resource kubectl get pods
watch 리소스 변경 이벤트 구독 GET /resource?watch=true
GET /resource/{name}?watch=true
kubectl get pods -w
Update (갱신) update (replace) 리소스 전체 교체[1] PUT /resource/{name} kubectl replace -f pod.yaml
patch 리소스 일부 수정 PATCH /resource/{name} kubectl patch pod mypod -p '{"spec":{...}}'
Delete (삭제) delete 단일 리소스 삭제 DELETE /resource/{name} kubectl delete pod mypod
deletecollection 리소스 집합 삭제 (전체/조건 필터) DELETE /resource?labelSelector=...
DELETE /resource?fieldSelector=...
kubectl delete pods --all
kubectl delete pods -l app=myapp
※ 여러 리소스를 이름으로 지정하면 delete가 반복 실행됨

$ kubectl get clusterroles -ojson | jq -r '.items[].rules[].verbs[]' | sort | uniq
*
approve
create
delete
deletecollection
escalate
get
impersonate
list
patch
proxy
sign
update
watch

2 같이 보기[ | ]

3 참고[ | ]

  1. 보통은 없는 경우 404 오류 반환, 일부 리소스에서는 생성처럼 동작하기도 함
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}