minikube kubectl 创建文件错误(验证数据:未设置 apiVersion)

minikube kubectl create file error (validating data: apiVersion not set)

我是一名学生,也是 minikube 和 linux 的新手。我的老师也做了同样的事情,他的 Pod 创建了,但我收到了错误。我不知道是什么问题。我应该忽略验证错误吗?

kubectl create -f myfirstpod.yaml
error: error validating "myfirstpod.yaml": error validating data: apiVersion not set; if you choose to ignore these errors, turn validation off with --validate=false

猫myfirstpod.yaml

 kind: Pod
 apiversion: v1
 metadata:
   name: myfirstpod
 spec:
   containers:
 name: container1
 image: aamirpinger/helloworld:latest
 ports:
   containerPort: 80

我正在使用这些版本:

你好像打错字了。它应该是 apiVersion 而不是 apiversion。此外,PodSpec 中的缩进似乎不正确。

你可以使用这个:

kind: Pod
apiVersion: v1
metadata:
  name: myfirstpod
spec:
  containers:
  - name: container1
    image: aamirpinger/helloworld:latest
    ports:
    - containerPort: 80