DEV Community

loading...
Cover image for Limitations on config updates

Limitations on config updates

Rohith V
Full Stack Engineer || Java || Graduated From Government Engineerig College Thrissur. Interested in Data Structures in Java
・1 min read

Sample Scenario

Is it possible to make any change to the config file which is having a kind: Pod and use kubectl to that file, well lets see what happens if we try to change the container port.

We are having a config file named client-pod.yml file.

apiVersion: v1
kind: Pod
metadata:
  name: client-pod
  labels:
    component: web
spec:
  containers:
    - name: client
      image: some image name
      ports:
        - containerPort: 3000
Enter fullscreen mode Exit fullscreen mode

Now I update the containerPort field to 9999

apiVersion: v1
kind: Pod
metadata:
  name: client-pod
  labels:
    component: web
spec:
  containers:
    - name: client
      image: some image name
      ports:
        - containerPort: 9999
Enter fullscreen mode Exit fullscreen mode

After changing the port and if we feed this config into kubectl, kubectl apply -f client-pod.yml, the output will be as follows :

2

Yes we will be getting an error saying we can't change the fields other than the fields mentioned in the terminal, so in our case we cannot change the container port.

Conclusion

Limitations on Updating Config file
Can only change spec.containers[*].image
Can only change spec.initContainers[*].image
Can only change spec.activeDeadlineSeconds
Can only change spec.tolerations

Discussion (0)