Cloud and Container Basics
Which of the following is an appropriate way to update the software on production servers in line with the idea of immutable infrastructure?
- ALog in to the running production servers with SSH, update the packages and then restart the service
- BCreate new servers from a new image that includes the update, switch over to them, and discard the old servers without modifying them
- CRewrite the configuration files by hand without stopping the production servers, and record the changes in a work log
Show answer and explanation
Answer: B. Create new servers from a new image that includes the update, switch over to them, and discard the old servers without modifying them
With immutable infrastructure, servers (virtual machines or containers) are never modified once created; when a change is needed, new ones are created from an image that includes the change and swapped in. Because every server is created from the same image, configurations do not drift apart from server to server through accumulated manual differences. When a problem occurs, recreating from the previous image restores the old state. Anything that must be kept, such as logs and data, is stored in storage or databases outside the servers.
- A. This modifies running servers directly and causes the state of each server to drift.
- B. Correct. Changes go into the image, and whole servers are replaced.
- C. Even with a record, the running servers are still changed by hand, which is not the immutable approach.