Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubectl apply -f cluster-configuration.yaml报错 #2260

Open
wangkun723 opened this issue Nov 17, 2023 · 2 comments
Open

kubectl apply -f cluster-configuration.yaml报错 #2260

wangkun723 opened this issue Nov 17, 2023 · 2 comments

Comments

@wangkun723
Copy link

[root@haiheng-151 ~]# kubectl apply -f cluster-configuration-new.yaml
error: unable to recognize "cluster-configuration-new.yaml": no matches for kind "ClusterConfiguration" in version "installer.kubesphere.io/v1alpha1"

百度了一下,把alpha1删去还是报错
error: unable to recognize "cluster-configuration.yaml": no matches for kind "ClusterConfiguration" in version "installer.kubesphere.io/v1"

怎么搞?

@wangkun723
Copy link
Author

[root@haiheng-151 ~]# kubectl apply -f kubesphere-installer.yaml
namespace/kubesphere-system unchanged
serviceaccount/ks-installer unchanged
clusterrole.rbac.authorization.k8s.io/ks-installer unchanged
clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged
deployment.apps/ks-installer configured
error: unable to recognize "kubesphere-installer.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1

解决方法:v1beta1改为 v1

[root@haiheng-151 ~]# kubectl apply -f kubesphere-installer.yaml
namespace/kubesphere-system unchanged
serviceaccount/ks-installer unchanged
clusterrole.rbac.authorization.k8s.io/ks-installer unchanged
clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged
deployment.apps/ks-installer unchanged
The CustomResourceDefinition "clusterconfigurations.installer.kubesphere.io" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required

解决方法,打开kubesphere-installer.yaml,添加内容是####。。。####,如下:


apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusterconfigurations.installer.kubesphere.io
spec:
group: installer.kubesphere.io
versions:

  • name: v1alpha1
schema:
  openAPIV3Schema:
    properties:
      apiVersion:
        type: string
      kind:
        type: string
      metadata:
        type: object
      spec:
        type: object
        x-kubernetes-preserve-unknown-fields: true
      status:
        type: object
        x-kubernetes-preserve-unknown-fields: true
    required:
    - metadata
    - spec
    type: object
######
served: true
storage: true

scope: Namespaced

再执行kubectl apply -f cluster-configuration-new.yaml就不会报错了

@gushenjie
Copy link

[root@haiheng-151 ~]# kubectl apply -f kubesphere-installer.yaml namespace/kubesphere-system unchanged serviceaccount/ks-installer unchanged clusterrole.rbac.authorization.k8s.io/ks-installer unchanged clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged deployment.apps/ks-installer configured error: unable to recognize "kubesphere-installer.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1

解决方法:v1beta1改为 v1

[root@haiheng-151 ~]# kubectl apply -f kubesphere-installer.yaml namespace/kubesphere-system unchanged serviceaccount/ks-installer unchanged clusterrole.rbac.authorization.k8s.io/ks-installer unchanged clusterrolebinding.rbac.authorization.k8s.io/ks-installer unchanged deployment.apps/ks-installer unchanged The CustomResourceDefinition "clusterconfigurations.installer.kubesphere.io" is invalid: spec.versions[0].schema.openAPIV3Schema: Required value: schemas are required

解决方法,打开kubesphere-installer.yaml,添加内容是####。。。####,如下:

apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: clusterconfigurations.installer.kubesphere.io spec: group: installer.kubesphere.io versions:

  • name: v1alpha1
schema:
  openAPIV3Schema:
    properties:
      apiVersion:
        type: string
      kind:
        type: string
      metadata:
        type: object
      spec:
        type: object
        x-kubernetes-preserve-unknown-fields: true
      status:
        type: object
        x-kubernetes-preserve-unknown-fields: true
    required:
    - metadata
    - spec
    type: object
######
served: true
storage: true

scope: Namespaced

再执行kubectl apply -f cluster-configuration-new.yaml就不会报错了

老哥,能不能讲明白一点,看了半天没看明白,到底怎么解决的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants