获取 kind 集群时出现未知的 API 版本。

huangapple go评论48阅读模式
英文:

Getting unknown API version when starting kind cluster

问题

尝试在Intel OSX 13.3.1上运行Kind,只是为了更多地了解Kubernetes。
使用Homebrew安装了kubectl和kind。

kubectl版本1.25.4
kind版本0.18.0
Docker Desktop版本4.18.0

我可以使用kind create cluster命令启动默认集群。

我查看了~/.kube/config文件,其中有apiVersion: v1

我删除了这个集群。

尝试按照以下文件启动多节点集群的示例。该文件通过了yamllint检查。

kind: Cluster
apiVersion: kind.x-k8s.io/v1
nodes:
  - role: control-plane
  - role: worker
  - role: worker
  - role: worker

并使用以下命令:

kind create cluster --config ~/.kube/kind_cluster.yml

但是遇到了以下错误:

ERROR: failed to create cluster: unknown apiVersion: kind.x-k8s.io/v1

有任何想法可能出了什么问题吗?

请注意,我已经尝试了许多基于各种其他“hellowworld”示例和搜索结果的apiVersion值,但没有成功。

英文:

Trying to get kind running on Intel OSX 13.3.1 just to learn more about kubernetes.
Installed kubectl and kind using homebrew.

kubectl version 1.25.4
kind version 0.18.0
Docker Desktop 4.18.0

I can stand up the default cluster with kind create cluster

I looked in the ~/.kube/config file and it has apiVersion: v1

I deleted this cluster

Tried to follow an example to start up a multi-node cluster with this file. The file passed yamllint.

kind: Cluster
apiVersion: kind.x-k8s.io/v1
nodes:
  - role: control-plane
  - role: worker
  - role: worker
  - role: worker

and this command

kind create cluster --config ~/.kube/kind_cluster.yml

And got this error

ERROR: failed to create cluster: unknown apiVersion: kind.x-k8s.io/v1

Any idea what may be wrong?

Note that I have tried numerous apiVersion values based on various other “hellowworld” examples and goggle-fu output with no luck.

答案1

得分: 1

你的 API 版本应该是 kind.x-k8s.io/v1alpha4,根据这里的文档 https://github.com/kubernetes-sigs/kind/blob/329a451909597f481bd3d313d054e9852537e2b9/site/content/docs/user/configuration.md?plain=1#L19-L24

我会复制粘贴以避免链接失效。

一个最小有效的配置是:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
英文:

Your APIVersion should be kind.x-k8s.io/v1alpha4 as per the docs here https://github.com/kubernetes-sigs/kind/blob/329a451909597f481bd3d313d054e9852537e2b9/site/content/docs/user/configuration.md?plain=1#L19-L24

I'll copy paste to avoid link rot though

A minimal valid config is:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4

huangapple
  • 本文由 发表于 2023年5月11日 02:07:36
  • 转载请务必保留本文链接:https://go.coder-hub.com/76221438.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定