Cons of immutable infrastructure – Immutable Infrastructure with Packer
The cons of immutable infrastructure are as follows:
- Building and deploying immutable infrastructure is a bit complex, and it is slow to add updates and manage urgent hotfixes
- There are storage and network overheads in generating and managing VM images
So, as we’ve looked at the pros and cons of both approaches, it ultimately depends on how you currently do infrastructure management and your end goal. Immutable infrastructure has a huge benefit, and therefore, it is something that every modern DevOps engineer should understand and implement if possible. However, technical and process constraints prevent people from doing it – while some constraints are related to the technology stack, most are simply related to processes and red tape. Immutable infrastructure is best when you need consistently reproducible and exceptionally reliable deployments. This approach minimizes the risk of configuration drift and streamlines updates by reconstructing entire environments instead of tweaking existing elements. It proves especially advantageous in scenarios such as microservices architectures, container orchestration, and situations where rapid scaling and the ability to roll back changes are paramount.
We all know that DevOps is not all about tools but it is a cultural change that should originate from the very top. If it is not possible to use immutable infrastructure, you can always use a config management tool such as Ansible on top of live servers. That makes things manageable to a certain extent.
Now, moving on to Packer, let’s look at how to install it.
Installing Packer
You can install Packer on a variety of platforms in a variety of ways. Please refer to https:// developer.hashicorp.com/packer/downloads. As Packer is available as an apt package, use the following commands to install Packer on Ubuntu Linux:
$ wget -O- https://apt.releases.hashicorp.com/gpg | sudo \
gpg –dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
$ echo “deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ https://apt.releases.hashicorp.com $(lsb_release -cs) main” | \ sudo tee /etc/apt/sources.list.d/hashicorp.list
$ sudo apt update && sudo apt install -y packer
To verify the installation, run the following command:
$ packer –version
1.9.2
As we see, Packer is installed successfully. We can proceed with the next activity in our goal – creating playbooks.