상세 컨텐츠

본문 제목

쿠버네티스 API 접근 제어

Kubernetes

by yiaw 2021. 11. 4. 21:37

본문

API 접근 제어

사용자는 kubectl 또는 특정 라이브러리로 구현된Client를 이용하여 REST API에 접근할 수 있습니다.

단 API에 접근 하기위해서는 몇가지 단계를 수행 해야하는데 해당 내용은 아래 링크를 통해서 한번 읽어 보시는 걸 추천 천드립니다.  

https://kubernetes.io/docs/concepts/security/controlling-access/

 

Controlling Access to the Kubernetes API

This page provides an overview of controlling access to the Kubernetes API. Users access the Kubernetes API using kubectl, client libraries, or by making REST requests. Both human users and Kubernetes service accounts can be authorized for API access. When

kubernetes.io


Authentication

접속을 요청 한 클라이언트와 사용자를 시스템이 인증하는 단계입니다. 

인증 방법이 여러개 존재하며 대표적으로는 TLS 인증Webhook 인증이 있습니다. 


Authorization

권한을 확인 하고 실제로 어떤 행동을 할 수 있는지 검증 하는 단계입니다.


Admission Control

인증과 권한을 확인 후 추가적인 요청에 대한 검증을 통해 강제로 요청 사항을 변경 하거나 요청을 반려 시킬 때 사용 합니다.

 

Dynamic Admission Controller 

쿠버네티스에서 확장 가능성 있는 여러 Plugin들을 사용 할 수있듯이

사용자가 Open API를 이용하여 자신만의 Admission Controller를 구현 할 수 있습니다. 

이런 Custerm Admission Conteroller를 Dynamic Admission Controller라고 부릅니다.

Dynamic Admission Controller는 MutatingWebhook ValidatingWebhook 존재 합니다.

 

MutatingWebhook 

사용자가 요청한 Request에 관여하여 관리자가 임의로 값을 변경 하는 작업을 합니다.

GCP, WAS 등을 사용 하면 Pod 생성시 Resource 제약을 강제하거나  특정 ServiceAccount를 강제로 사용 하도록 만드는 작업등이 MutatingWebhook에 해당합니다. 

ValidatingWebhook

사용자가 요청한 Request에 대해서 관리자가 요청을 반려 또는 허용하는 작업을 합니다. 

사용자가 특정 Host 파일을 Mount 할 경우 에러 메시지와 함께 요청을 반려 할 수 있습니다.

 

Kubernetes Admission Controllers를 테스트 해볼 수 있는 예제나 자세한 설명은 Kubernetes 공식 블로그에 작성 되어있습니다.

https://kubernetes.io/blog/2019/03/21/a-guide-to-kubernetes-admission-controllers/

 

A Guide to Kubernetes Admission Controllers

Author: Malte Isberner (StackRox) Kubernetes has greatly improved the speed and manageability of backend clusters in production today. Kubernetes has emerged as the de facto standard in container orchestrators thanks to its flexibility, scalability, and ea

kubernetes.io

 


마치며

이번 포스팅에서는 전체적으로 kubernetes에서 API를 접근 제어 하는 방법에대해서 살펴 보왔습니다. 

다음 포스팅에서는 ValidatingWebhook을 구현하여 사용자 요청을 어떻게 반려 시키고 허용 시키는지 테스트를 해보도록 하겠습니다.

'Kubernetes' 카테고리의 다른 글

Dynamic Admission Controller - MutatingWebhook  (0) 2021.11.05

관련글 더보기

댓글 영역