The Deployment "app1" is invalid: spec.selector: Invalid value: v1.LabelSelector ... field is immutable

1 개요[ | ]

The Deployment "nginx1" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"nginx1", "hello":"world"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

2 실습[ | ]

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app1
spec:
  selector:
    matchLabels:
      app: app1
  template:
    metadata:
      labels:
        app: app1
    spec:
      containers:
      - name: app1
        image: nginx
root@localhost:~# kubectl apply -f a.yaml
deployment.apps/app1 configured
apiVersion: apps/v1
kind: Deployment
metadata:
  name: app1
spec:
  selector:
    matchLabels: #### 변경불가
      app: app1
      hello: world ##
  template:
    metadata:
      labels:
        app: app1
        hello: world
    spec:
      containers:
      - name: app1
        image: nginx
root@localhost:~# kubectl apply -f a.yaml
The Deployment "app1" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app":"app1", "hello":"world"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}