
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: internals.datasets.kodekloud.com spec: group: datasets.kodekloud.com versions: - name: v1 served: true storage: true schema: openAPIV3Schema: type: object properties: spec: type: object properties: internalLoad: type: string range: type: integer percentage: type: string scope: Namespaced names: plural: internals singular: internal kind: Internal shortNames: - int | cs |
.metadata.name : crd의 이름. plural+group의 조합으로 구성.spec.group : API 이름.spec.versions.name : API 버전.spec.versions.schema.openAPIV3Schema.properties.spec.properties : crd에서 요구하는 값.spec.scope : crd 적용 범위. Namespaced 또는 Cluster.spec.names.plural : URL로 호출 시 사용할 alias.spec.names.singular : CLI로 핸들링 시 사용할 alias.spec.names.kind : crd 매니페스트 생성 시 기입할 kind. 일반적으로 singular를 카멜케이스 형식으로 작성.spec.names.shortNames : crd의 단축어 1 2 3 4 5 6 7 8 9 | kind: Internal apiVersion: datasets.kodekloud.com/v1 metadata: name: crd-test-internal namespace: default spec: internalLoad: "high" range: 80 percentage: "50" | cs |
.apiVersion : .spec.group/.spec.versions.name.spec : .spec.versions.schema.openAPIV3Schema.properties.spec.properties에 정의한 값k get crd : Custom Resource 목록 확인
k describe crd [crd_name] : Custom Resource 세부 정보 확인
k delete crd [crd_name] : Custom Resource 삭제
k get [shortNames] : crd를 통해 생성한 리소스 확인