Learning Devops.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
Learning DevOps The complete guide to accelerate collaboration with Jenkins, Kubernetes, Terraform and Azure DevOps Mikael Krief BIRMINGHAM - MUMBAI Learning DevOps Copyright © 2019 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Commissioning Editor: Vijin Boricha Acquisition Editor: Meeta Rajani Content Development Editor: Drashti Panchal Senior Editor: Arun Nadar Technical Editor: Prachi Sawant Copy Editor: Safis Editing Project Coordinator: Vaidehi Sawant Proofreader: Safis Editing Indexer: Tejal Daruwale Soni Production Designer: Nilesh Mohite First published: October 2019 Production reference: 1251019 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-83864-273-0 www.packt.com I would like to dedicate this book to my wife and children, who are my source of happiness. Foreword Having discussed DevOps with Mikael Krief on several occasions, it is clear that he understands the importance of empowering both Dev and Ops in order to deliver value. DevOps is the union of people, processes, and products to enable the continuous delivery of value to our end users. Value is the most important word of that definition. DevOps is not about software, automation, shipping a feature, or getting to the bottom of your product backlog. It is about delivering value. To deliver value, you must measure your application while it is running in production and use the telemetry to guide what you deliver next. To deliver value, your team must fully embrace the culture of DevOps. The hardest part of DevOps is the people part: building the culture that is required to succeed. Learning DevOps does a great job of focusing on the culture behind DevOps. To succeed, you must change the way your team thinks about their roles. Everyone must have a common goal that encourages collaboration. Delivering value to the end user is the responsibility of everyone involved in the application. Our community tends to spend more time on the Dev side of DevOps. Learning DevOps, however, has invested considerable time on Infrastructure as Code. As more workloads move to the cloud, IaC becomes more valuable. The ability to provision and configure your infrastructure as part of your pipeline allows engineers to innovate. IaC can save companies money by shutting down environments when they are no longer in use or simply provisioning them on demand. Once your entire infrastructure is stored in version control and acted upon via your pipeline, recovering from a disaster is simply a deployment. The time to debate whether you should or should not implement DevOps is over. You either implement DevOps or you lose. Donovan Brown Principal Cloud Advocate Manager at Microsoft Packt.com Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Fully searchable for easy access to vital information Copy and paste, print, and bookmark content Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. Contributors About the author Mikael Krief lives in France and works as a DevOps engineer, and for 4 years he has worked as a DevOps consultant and DevOps technical officer at an expert consulting company in Microsoft technologies. He is passionate about DevOps culture and practices, ALM, and Agile methodologies. He loves to share his passion through various communities, such as the ALM | DevOps Rangers community, which he has been a member of since 2015. He also contributes to many open source projects, writes blogs and books, speaks at conferences, and publishes public tools such as extensions for Azure DevOps. For all his contributions and passion in this area, he has received the Microsoft© Most Valuable Professional (MVP) award for the last 4 years. I would like to extend my thanks to my family for accepting that I needed to work long hours on this book during family time. I would like to thank Meeta Rajani for giving me the opportunity to write this book, which was a very enriching experience. Special thanks to Drashti Panchal, Prachi Sawant, Arun Nadar for their valuable input and time reviewing this book and to the entire Packt team for their support during the course of writing this book. About the reviewers Abhinav Krishna Kaiser manages in a leading consulting firm. He is a published author and has penned three books on DevOps, ITIL, and IT communication. Abhinav has transformed multiple programs into the DevOps ways of working and is one of the leading DevOps architects on the circuit today. He has assumed the role of an Agile Coach to set the course for Agile principles and processes in order to set the stage in development. Apart from DevOps and Agile, Abhinav is an ITIL expert and is a popular name in the field of IT service management. Abhinav's latest publication, on recasting ITIL with the DevOps processes, came out in 2018. Reinventing ITIL in the Age of DevOps transforms the ITIL framework to work in a DevOps project. His earlier publication, Become ITIL Foundation Certified in 7 Days, is one of the top guides for IT professionals looking to become ITIL Foundation certified and to those getting into the field of service management. Abhinav started consulting with clients 15 years ago on IT service management, where he created value by developing robust service management solutions. Moving with the times, he eventually went into DevOps and Agile consulting. He is one of the foremost authorities in the area of configuration management and his solutions have stood the test of time, rigor, and technological advancements. Abhinav blogs and writes guides and articles on DevOps, Agile, and ITIL on popular sites. While the life of a consultant is to go where the client is, currently he is based in London, UK. He is from Bangalore, India, and is happily married with a daughter and a son. Ebru Cucen works as a technical principal consultant at Contino, and is also a public speaker and trainer on Serverless. She has a BSc in mathematics and started her journey as a .NET developer/trainer in 2004. She has over 10 years of experience in digital transformation of financial enterprise companies. She's spent the last 5 years working with the cloud, covering the full life cycle of feature development/deployment and CI/CD pipelines. Being a lifetime student, she loves learning, exploring, and experimenting with technology to understand and use it to make our lives better. She enjoys living in London with her 7-year-old son and her husband, Tolga Cucen, to whom she is thankful for supporting her during the nights/weekends she has worked on this book. Packt is searching for authors like you If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Table of Contents Preface 1 Section 1: DevOps and Infrastructure as Code Chapter 1: DevOps Culture and Practices 8 Getting started with DevOps 9 Implementing CI/CD and continuous deployment 12 Continuous integration (CI) 12 Implementing CI 13 Continuous delivery (CD) 15 Continuous deployment 17 Understanding IaC practices 19 The benefits of IaC 19 IaC languages and tools 20 Scripting types 20 Declarative types 20 The IaC topology 22 The deployment and provisioning of the infrastructure 22 Server configuration 22 Immutable infrastructure with containers 24 Configuration and deployment in Kubernetes 24 IaC best practices 25 Summary 27 Questions 28 Further reading 28 Chapter 2: Provisioning Cloud Infrastructure with Terraform 29 Technical requirements 29 Installing Terraform 30 Manual installation 30 Installation by script 31 Installing Terraform by script on Linux 31 Installing