Kubernetes ReplicaSet

What is the difference between the following commands in context to replicaset?

  • Update the number of replicas directly in the yaml file
  • Use the scale command: kubectl scale —replicas=6 -f
  • Use the scale command: kubectl scale replicaset my-replica —replicas=6
  • Use the kubectl edit command: kubectl edit replicaset my-replica

The second one won’t work as you haven’t said which replicaset to scale.
The third one is the correct syntax of the second one

1 (after kubectl apply the change), 3 and 4 will all end up with the same result

1 Like

Thanks you for the answer. If the second one had -f <file_name> then it would also have the result as the others, right?

Yes, if the file correctly represents the resource to be scaled.

1 Like