我在yaml文件下面创建了ReplicaSet。
apiVersion: apps/v1beta1
kind: ReplicaSet
metadata:
name: kubia
spec:
replicas: 2
selector:
matchLabels:
app: kubia
template:
metadata:
labels:
app: kubia
spec:
containers:
- name: kubia
image: luksa/kubia
然后我尝试使用以下命令创建ReplicaSet,我收到错误。
$ kubectl create -f chapter4/kubia-replicaset.yaml
error: error validating "chapter4/kubia-replicaset.yaml": error validating data: unknown objec
t type schema.GroupVersionKind{Group:"apps", Version:"v1beta1", Kind:"ReplicaSet"}; if you choose to ignore these errors, turn validation off with --validate=false
我尝试了不同的apiVersion值,例如apps / v1,apps / v1beta1,extensions / v1,extensions / v1beta1等,但没有任何帮助。
我的kubernetes版本是 -
$ kubectl versionClient Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.6", GitCommit:"6260bb08c46c31eea6cb538b34a9ceb3e406689c", GitTreeState:"clean", BuildDate:"2017-12-21T06:34:11Z", GoVers
ion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}Server Version: version.Info{Major:"1", Minor:"8+", GitVersion:"v1.8.7-gke.1", GitCommit:"192ccad06d24af9828cbf42330e1d915cb586406", GitTreeState:"clean", BuildDate:"2018-01-31T21:39:04Z",
GoVersion:"go1.8.3b4", Compiler:"gc", Platform:"linux/amd64"}
知道什么应该是正确的值apiVersion。
答案 0 :(得分:1)
根据Kubernetes 1.8 API reference,以下API组中提供了ReplicaSet
资源:
apps/v1beta2
extensions/v1beta1
(已弃用)从Kubernetes 1.9开始,ReplicaSet
API组中还可以找到apps/v1
资源,弃用以前的apps/v1beta2
对象。