aks 无法创建 kubernetes 副本集

aks can't create a kubernetes replica set

尝试从 yaml 文件创建 kubernetes 副本集时,我总是在 AKS 上收到此错误:

kubectl create -f kubia-replicaset.yaml error: unable to recognize "kubia-replicaset.yaml": no matches for apps/, Kind=ReplicaSet

我尝试了几个不同的文件以及 K8s 文档中的示例,但都导致了这个失败。创建 Pods 和 RC 有效

下面是 yaml 文件:

apiVersion: apps/v1beta2
kind: ReplicaSet
metadata:
  name: kubia
spec:
  replicas: 3
  selector:
    matchLabels:
      app: kubia
  template:
    metadata:
      labels:
        app: kubia
    spec:
      containers:
      - name: kubia
        image: luksa/kubia

应该建议现在使用deployments:

A Deployment controller provides declarative updates for Pods and ReplicaSets.

You describe a desired state in a Deployment object, and the Deployment controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments.

还有这首曲子:

Kubectl rolling update updates Pods and ReplicationControllers in a similar fashion. But Deployments are recommended, since they are declarative, server side, and have additional features, such as rolling back to any previous revision even after the rolling update is done.

另外,看看here

将 apps/v1beta2 更改为 apps/v1 适合我。