Bootstrapping Microservices with Docker, Kubernetes, and Terraform
A project-based guide
Ashley Davis
To comment go to liveBook
Manning
Shelter Island
For more information on this and other Manning titles go to
manning.com
Copyright
For online information and ordering of these and other Manning books, please visit manning.com. The publisher offers discounts on these books when ordered in quantity.
For more information, please contact
Special Sales Department
Manning Publications Co.
20 Baldwin Road
PO Box 761
Shelter Island, NY 11964
Email: orders@manning.com
2021 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.
| Manning Publications Co. 20 Baldwin Road Technical PO Box 761 Shelter Island, NY 11964 |
Development editor: | Helen Stergius |
Technical development editor: | Jeanne Boyarsky |
Review editor: | Aleks Dragosavljevi |
Production editor: | Lori Weidert |
Copy editor: | Frances Buran |
Proofreader: | Jason Everett |
Technical proofreader: | Alain Couniot |
Typesetter: | Gordan Salinovi |
Cover designer: | Marija Tudor |
ISBN: 9781617297212
front matter
preface
I first tried building applications with microservices around 2013. That was the year Docker was initially released, but back then, I hadnt heard about it. At that time, we built an application with each microservice running on a separate virtual machine. As you might expect, that was a really expensive way to run microservices.
Because of the high running costs, we then opted to create fewer rather than more microservices, pushing more and more functionality into the existing microservices to the point where we couldnt really call these microservices. It was still a distributed application of course, just not micro-sized in the way we had hoped.
I already knew at that stage that microservices were a powerful idea, if only they were cheaper. I put microservices back on the shelf, but made a note that I should look at those again later.
Over the years, I watched from the sideline as the tools and technology around microservices developed, powered by the rise (and rise) of open source coding. And I looked on as the cost of cloud computing continued to drop, spurred on by competition between vendors. Over time, it was clear that building and running a distributed application with micro-sized components was becoming more cost effective.
After what seemed like a lifetime, in early 2018, I officially returned to the world of microservices. I had two opportunities for which I believed microservices were the right fit. Both were startups. The first was a contract job to bootstrap a new microservices application for a promising young company. The second was building a microservices application for my own startup.
To be successful, I knew that I needed new tools. I needed an effective way to package microservices. I needed a computing platform on which I could deploy microservices. Crucially, I needed to be able to automate deployments.
By then, Docker had already gained a big foothold in our industry, so I knew it was a safe bet as a way to package microservices. I also liked the look of Kubernetes as a computing platform for microservices, but early on, I was extremely uncertain about it. Kubernetes, however, promised a future of freedom from the tyranny of cloud vendor lockin-that was very appealing.
At this point, Id read quite a few books on microservices. These were all interesting, providing good value on a theoretical level. I do enjoy reading the theory, but these books lacked the practical examples that would have helped me smash through my own learning curve. Even as an experienced developer, I was struggling to know where to start! I knew from past experience that bad technical decisions made at the beginning of a project would haunt me to the end.
Learning Kubernetes was especially difficult. From the outside, it seemed incredibly difficult to penetrate. But I had a job to do, and I needed a way to deliver software. So I pushed on. The going was tough, and I almost gave up on Kubernetes a few times.
The situation changed when I discovered Terraform. This was the missing piece of the puzzle for me. Its what made Kubernetes understandable and usable to the point where I could do nothing else but commit to using it.
Terraform is the tool that allowed me to describe the structure of my application. Terraform could then live in my continuous delivery (CD) pipeline and automatically keep my application up to date! I began writing infrastructure as code, and it felt like I had moved to the big league.
I forced my way through the learning curve, bolstered by my long-time experience of evaluating technology and learning quickly on the job, with a splash of trial and error mixed in for good measure. My efforts delivered software that is performant, flexible, reliable, scalable, extensible, and still running to this day. Through this time, my desire to write this book sparked and grew to the point where I had to take action.
A new mission formed-I wanted to make microservices more accessible. I felt compelled to write this book; its the book I wanted but didnt have. I knew I could help people, and the best way to do that was with a practical book, this book. A book that shows you, step by step, that microservices dont have to be difficult or complex; it all depends on your approach and the perspective you take. You now have in your hands the fruits of that labor. I learned the hard way so that you dont have to.
acknowledgments
In Bootstrapping Microservices, I share my years of hard-won experience with you. Such experience wouldnt be possible without being surrounded by people who supported and encouraged me.
There are many who helped me get to where I am today. I wouldnt be a developer without my parents, Garry and Jan, who bought me my first PC. My partner in life, Antonella, who has tirelessly supported me through two books now. My partner in business, Majella, who listens to all my rants about technology, and still pushes me forward. Thank you all!
Next page