Deciding to switch to immutable infrastructure is difficult, especially when your Ops team treats servers as pets. Most people get paranoid about the idea of deleting an existing server and creating a new one for every update. Well, you need to do a lot of convincing when you first come up with the idea. However, it does not mean that you must use immutable infrastructure to do proper DevOps. It all depends on your use case.
Let’s look at each approach’s pros and cons to understand them better.
Pros of mutable infrastructure
Let’s begin with the pros of mutable infrastructure:
- If adequately managed, mutable infrastructure is faster to upgrade and change. It makes security patches quicker.
- It is simpler to manage, as we don’t have to worry about building the entire VM image and redeploying it for every update.
Cons of mutable infrastructure
Next, let’s see the cons of mutable infrastructure:
- It eventually results in configuration drift. When people start making changes manually in the server and do not use a config management tool, it becomes difficult to know what’s in the server after a particular point. Then, you will have to start relying on snapshots.
- Versioning is impossible with mutable infrastructure, and rolling back changes is troublesome.
- There is a possibility of partial updates because of technical issues such as a patchy network, unresponsive apt repositories, and so on.
- There is a risk because changes are applied directly to the production environment. There is also a chance that you will end up in an unanticipated state that is difficult to troubleshoot.
- Because of configuration drift, it is impossible to say that the current configuration is the same as being tracked in version control. Therefore, building a new server from scratch may require manual intervention and comprehensive testing.
Similarly, let’s look at the pros and cons of immutable infrastructure.
Pros of immutable infrastructure
The pros of immutable infrastructure are as follows:
- It eliminates configuration drift as the infrastructure cannot change once deployed, and any changes should come via the CI/CD process.
- It is DevOps-friendly as every build and deployment process inherently follows modern DevOps practices.
- It makes discrete versioning possible as every image generated from an image build can be versioned and kept within an image repository. That makes rollouts and rollbacks much more straightforward and promotes modern DevOps practices such as canary and blue-green deployments with A/B testing.
- The image is pre-built and tested, so we always get a predictable state from immutable infrastructure. We, therefore, reduce a lot of risk from production implementations.
- It helps with horizontal scaling on the cloud because you can now create servers from pre-built images, making new VMs faster to start up and get ready.
Leave a Reply