在stackoverflow上 也有人这样提问
看到回答是
Selector directives in Deployments require you to use a sub-field of either matchLabels
or matchExpressions
, so in my case I need to make use of matchLabels
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: redis spec: replicas: 3 selector: matchLabels: name: redis template: metadata: labels: name: redis spec: containers: - name: redis image: kubernetes/redis:v1 ports: - containerPort: 6379 resources: limits: cpu: "0.1" volumeMounts: - mountPath: /redis-master-data name: data volumes: - name: data emptyDir: {}