반응형
목차
증상
아래명령어를 입력
kubectl apply -f .\test-crd.yaml
error: resource mapping not found for name: "test.extension.example.com" namespace: "" from ".\\test-crd.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
원인
v1beta1이 1.16부터 지원되지 않는다.
apiVersion: apiextensions.k8s.io/v1
로 변경하면 이런 에러가 나오는데
Error from server (BadRequest): error when creating ".\\test-crd.yaml": CustomResourceDefinition in version "v1" cannot be handled as a CustomResourceDefinition: strict decoding error: unknown field "spec.version"
해결
다음과 같이 version 부분을 변경해야한다.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
# name must match the spec fields below, and be in the form: <plural>.<group>
name: crontabs.stable.example.com
spec:
# group name to use for REST API: /apis/<group>/<version>
group: stable.example.com
# list of versions supported by this CustomResourceDefinition
versions:
- name: v1
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
cronSpec:
type: string
image:
type: string
replicas:
type: integer
# either Namespaced or Cluster
scope: Namespaced
names:
# plural name to be used in the URL: /apis/<group>/<version>/<plural>
plural: crontabs
# singular name to be used as an alias on the CLI and for display
singular: crontab
# kind is normally the CamelCased singular type. Your resource manifests use this.
kind: CronTab
# shortNames allow shorter string to match your resource on the CLI
shortNames:
- ct
reference version
끝
반응형
'K8S' 카테고리의 다른 글
Falco 란? (0) | 2023.08.23 |
---|---|
kubernetes kude 설치 mac, linux (0) | 2023.08.20 |
AWS EKS 에서 docker desktop kubenetes로 전환, 변경하는 방법 (0) | 2023.08.15 |
kubernetes 네임스페이스 삭제 (0) | 2022.12.29 |
[kubernetes] Error while setting up kubernetes: cannot expose the external port... 에러 - Docker desktop (0) | 2022.11.18 |
댓글