I am attempting to install istio
in my DO K8s cluster.
I have created a null resource to download istio
and run the helm charts using this example - https://mohsensy.github.io/sysadmin/2021/04/09/install-istio-with-terraform.html
TF looks like -
resource "kubernetes_namespace" "istio_system" {
metadata {
name = "istio-system"
}
}
resource "null_resource" "istio" {
provisioner "local-exec" {
command = <<EOF
set -xe
cd ${path.root}
rm -rf ./istio-1.9.2 || true
curl -sL https://istio.io/downloadIstio | ISTIO_VERSION=1.9.2 sh -
rm -rf ./istio || true
mv ./istio-1.9.2 istio
EOF
}
triggers = {
build_number = timestamp()
}
}
resource "helm_release" "istio_base" {
name = "istio-base"
chart = "istio/manifests/charts/base"
timeout = 120
cleanup_on_fail = true
force_update = true
namespace = "istio-system"
depends_on = [
digitalocean_kubernetes_cluster.k8s_cluster,
kubernetes_namespace.istio_system,
null_resource.istio
]
}
I can see the istio
charts are downloaded with the CRDs.
│ Error: failed to install CRD crds/crd-all.gen.yaml: unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
│
│ with helm_release.istio_base,
│ on istio.tf line 32, in resource "helm_release" "istio_base":
│ 32: resource "helm_release" "istio_base" {
I need help in understanding what unable to recognize ""
tells here!
I am looking for a resolution with some explanation.
CodePudding user response:
The error is trying to help you out:
unable to recognize "": no matches for kind "CustomResourceDefinition" in version "apiextensions.k8s.io/v1beta1"
Take a look at the API resources available in your Kubernetes enviornment:
$ kubectl api-resources | grep CustomResourceDefinition
You will probably see something like:
customresourcedefinitions crd,crds apiextensions.k8s.io/v1 false CustomResourceDefinition
Note the API version there: it's aspiextensions.k8s/io/v1
, not /v1beta1
. Your manifest was built for an older version of Kubernetes. Changes are you can just change the apiVersion
in the manifest to the correct value and it will work.