Kubernetes 확장 메커니즘
개요
커스텀 리소스 정의(CRD)
CRD 기본 개념
CRD 생성 예시
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: webapps.example.com
spec:
group: example.com
names:
kind: WebApp
listKind: WebAppList
plural: webapps
singular: webapp
shortNames:
- wa
scope: Namespaced
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
replicas:
type: integer
minimum: 1
image:
type: string
port:
type: integer
required: ["image"]
status:
type: object
properties:
availableReplicas:
type: integer
conditions:
type: array
items:
type: object
properties:
type:
type: string
status:
type: string
lastTransitionTime:
type: string
additionalPrinterColumns:
- name: Replicas
type: integer
jsonPath: .spec.replicas
- name: Image
type: string
jsonPath: .spec.image
- name: Age
type: date
jsonPath: .metadata.creationTimestamp
subresources:
status: {}
scale:
specReplicasPath: .spec.replicas
statusReplicasPath: .status.availableReplicas커스텀 리소스 인스턴스 생성
커스텀 컨트롤러
컨트롤러 패턴
컨트롤러 구현 방법
1. client-go 사용
2. controller-runtime 사용
Operator 패턴
Operator SDK
API 서버 확장
1. 어그리게이션 레이어(Aggregation Layer)
2. 웹훅(Webhook)
어드미션 웹훅(Admission Webhook)
스케줄러 확장
1. 스케줄러 프레임워크
2. 스케줄러 익스텐더(Scheduler Extender)
네트워크 플러그인
CNI(Container Network Interface)
스토리지 플러그인
CSI(Container Storage Interface)
결론
마지막 업데이트