@Mumshad Mannambeth while I try to edit pod,deployment or pvc ,I get error "res . . .

Zul:
@Mumshad Mannambeth while I try to edit pod,deployment or pvc ,I get error “resource fails with edit cancelled,no changes made to file”. So after esc when I try to save file with :wq! Command ,it does not work.Can you help this

Tej_Singh_Rana:
Hello, @Zul
Because some fields are in form of mutables, and you can’t change through kubectl edit.

Tej_Singh_Rana:
You cannot edit specifications of an existing POD other than the below:
• spec.containers[].image
_• spec.initContainers[
]_.image
• spec.activeDeadlineSeconds
• spec.tolerations

Zul:
@Tej_Singh_Rana For instance, I tried to change allocated capacity in pvc which can be changed.

Zul:
@Tej_Singh_Rana I have tried to use edit command on one of labs and it worked but again it does not work in other cluster.

Tej_Singh_Rana:
Hello, @Zul
Can you please tell me? What are you trying to do?

Zul:
@Tej_Singh_Rana I am trying to edit deployment and adding port in it.
port:
containerPort: 80
name: abc
protocol: TCP

Tej_Singh_Rana:
Can you please tell me one thing?

  1. You’re adding a new fields in the existing deployment
  2. Trying to update above fields with new data - like port number (80)

Zul:
@Tej_Singh_Rana above field are not present.I am adding it.

Tej_Singh_Rana:
I just checked and able to edit above fields in the existing deployment.

Dhananjay Singh Sengar:
The key should be “ports” rather than “port”. Also this key is a list and should come under containers in pod specification.
`containers:

  • ports:
    • containerPort: 80
      name: abc
      protocol: TCP`

Zul:
@Dhananjay Singh Sengar It works when I use in Mumshad course labs but kubectl edit command didnt worked in exam even when I tried to change a existing value e.g change from 10Mi to 15Mi storage capacity.So actual issue is why it didnt worked there.What could be issue.