kuberneteskind

Unable to install CRDs in kubernetes kind


I am setting up a kind cluster

Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.22.1) 🖼 
 ✓ Preparing nodes 📦 📦  
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Joining worker nodes 🚜 
 ✓ Waiting ≤ 5m0s for control-plane = Ready ⏳ 
 • Ready after 0s 💚

and then trying to install ECK operator as per instructions about version 1.6

kubectl apply -f https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml

However the process fails, as if kind does not support CRDs...Is this the case?

namespace/elastic-system created
serviceaccount/elastic-operator created
secret/elastic-webhook-server-cert created
configmap/elastic-operator created
clusterrole.rbac.authorization.k8s.io/elastic-operator created
clusterrole.rbac.authorization.k8s.io/elastic-operator-view created
clusterrole.rbac.authorization.k8s.io/elastic-operator-edit created
clusterrolebinding.rbac.authorization.k8s.io/elastic-operator created
service/elastic-webhook-server created
statefulset.apps/elastic-operator created
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
unable to recognize "https://download.elastic.co/downloads/eck/1.6.0/all-in-one.yaml": no matches for kind "ValidatingWebhookConfiguration" in version "admissionregistration.k8s.io/v1beta1"

Solution

  • The problem you're seeing here isn't related to kind, instead it's the manifest you're trying to apply is using outdated API versions, which were removed in Kubernetes 1.22

    Specifically the manifest is using the v1beta1 version of the customresourcedefinition object and validatingadmissionwebhook object

    apiVersion: apiextensions.k8s.io/v1beta1
    kind: CustomResourceDefinition
    

    As noted in this post that was one of the versions removed when 1.22 went in.

    There's a couple of fixes for this. Firstly you could get the manifest and just change the customresourcedefinitions to use the new API version apiextensions.k8s.io/v1 and validatingadmissionwebhook to use admissionregistration.k8s.io/v1.

    The other fix would be to use an older version of Kubernetes. if you use 1.21 or earler, that issue shouldn't occur, so something like kind create cluster --image=kindest/node:v1.21.2 should work.