Junior — Middle
How is rollback of changes performed in Kubernetes when logical errors occur?
sobes.tech AI
Answer from AI
In Kubernetes, rollback of changes due to logical errors is usually performed using the Rollback mechanism in controllers such as Deployment. When updating a Deployment, a new ReplicaSet is created, and the previous one is preserved. If the new version of the application does not work correctly, you can rollback to the previous stable version with the command:
kubectl rollout undo deployment/<deployment-name>
This will revert the Deployment to its previous working state. You can also use update strategies, such as Rolling Update with health checks (readiness/liveness probes), to minimize risks during deployment. For more complex scenarios, tools like Helm are used, which store release history and allow rollback to previous chart versions.