 Hello everyone. My name is Prasanjit and today I will talk about GitOps. This session is meant for GitOps beginners to grasp the concepts and get onboarded. And I will do that in a unique way by telling you a story. So this story is an analogy that will help you understand GitOps and relate it to concepts. And we call this story a tall tale of GitOps. Now before we begin a little bit about me, my name is Prasanjit Singh and I am the Cloud and DevOps Director at Stars Play Dubai. We are a large scale media streaming service in the Middle East and North Africa region. And I am also a subject matter expert and trainer at Coursera. I am an AWS Community Builder, CNCF speaker and speak widely at different meetups. And I also like to teach a lot. So I have recently opened up a YouTube channel called Binpipe. You can subscribe to that as well. So let's get started with the tall tale of GitOps. So what is cooking? What are we going to learn today? Well, as I said, this session is a beginner session and I will tell you a story and that story is about a honeybee. And using that story and the analogies, we will be able to relate about GitOps practices and understand what it is for, when to use it and how to use it. Well, once upon a time, there was a little honeybee. His name was Gitbee. He had lost his parents and lived with his grandma, Lilybee. Now, Lilybee, the grandma, owned the largest pastry shop in town and the shop was famous for honeycakes, honey waffles and a special rainbow donut called Unicorn Poop. As days passed, Lilybee was growing old and weak and she asked Gitbee to help her with her business. And that's how Gitbee started working on his grandma's pastry shop. And as Gitbee started working with his grandma in her cake shop, grandma realized that Gitbee wasn't an ordinary little bee. He was more intelligent and brighter than others his age and believed in smart work rather than slogging it out with monotonous chores. On his first day as an apprentice, grandma Lily asked him to bake three different flavors of honey cake. And asked him to do the same thing every day for the rest of the week. Now, Gitbee being smart and organized made a list of ingredients that were used to make the batter for the cakes. And he put those batter in separate mixing bowls and tagged them. And if he needed more batter of a particular flavor, he could use the same amount of ingredients and literally clone his batter power. Also, since there were other worker bees in the factory, all of them needed to have access to the batter and other ingredients. So, tagging and organizing the raw materials helped Gitbee to allow his team members to work in unison on the same recipe. So that way, Granny Bee's problems were getting solved. She has this problem of not being able to manufacture a large amount of cakes because she was getting old and her workers couldn't work well without direction and organization. So, those were her problems. And Gitbee solved this problem by tagging the different ingredients and tagging the different bowls and separating mixing bowls with different flavors of the batter that were going to be used to bake the cakes. Gitbee being smart organized the ingredients that made the batter in separate mixing bowls and tagged them. If he needed more of the batter of a particular flavor, he could use same amount of ingredients and literally clone his batter bowl. Also, since there were other worker bees in the factory, all of them needed to have access to the batter and other ingredients, of course. So, tagging and organizing the raw materials helped Gitbee allow his team members to work in unison on the same recipe. And even if some of them were working on different recipes, there was no risk of ingredients getting mixed up. So, it improved their productivity. They could have multiple different cakes rolled out and they became more organized in the way they were making or baking their cakes. Now, if we want to correlate Gitbee's tagging system to software development, we can see that Git is a version control system used for tracking changes in computer files. Git is generally used for source code management and software development. Git is used for tracking changes in the source code. And it also allows multiple developers to work together similar to how multiple worker bees were able to bake cakes. And it also supports non-linear development through its thousands of parallel branches. So, using Git we can develop multiple features, have a multi-developer team, all working together towards the same end product, but each one working independently on a separate feature. So, all those could be enabled. So, that is what Git is all about. Now, let's go get back to the story. Now, there would be times when grandma Lily Bee would get a large number of orders from across the town and they would need multiple worker bees on baking multiple cakes and of multiple flavors, of course. Here, Gitbee had another idea. He forked out his batter into separate containers dedicated to worker bees and assigned them the tasks. Now, similar to how Gitbee worked with multiple worker bees on multiple cake recipes and was able to roll out his cakes faster using versioning. Similarly, in software development, we can use Git and use and take advantage of its various features. Like, it allows you to track history of whatever code you are writing and that opens up the possibility of making mistakes and then going back and correcting them. And of course, it's free and open source. It supports non-linear development and creates backups. As I said, you can roll back anytime if you're using Git. It's scalable. You can have multiple people using the same repository, working on the same projects, forking out their different features and working on them. And of course, it supports collaboration. It's easy to branch out different forks and it allows distributed environment, which is very important in today's times when we are all working remotely. So distributed development is indispensable for helping an engineering team to succeed. Now, the process of baking cakes wasn't an easy task. It involved a series of steps from mixing the ingredients, whipping the batter, adding eggs, baking it in the oven and finally topping it with the cream. Now, Gitbee felt these tasks being repetitive can be defined as a workflow. So, he wrote down the rules and the sequence of tasks to follow until the cake is baked. So, he had his series of sequences perfectly defined and he knew what to do and what would come after the other. Similarly, in software development world, as software applications become more and more sophisticated, the demands on infrastructure increases. Infrastructure teams need to support complex deployments and at an immense scale and speed. While much of application development has been automated, infrastructure has remained largely a manual process requiring specialized teams. Infrastructure as a code and tools like Ansible and Terraform are a good start, but they don't solve the entire problem. The teams need a perspective or workflow that puts infrastructure as code into action automatically. Now, that is where the term GitOps comes in. So, you have your tools Ansible, Terraform, but these are all distributed tools. They would not allow you to make an end-to-end deployment or automation of your infrastructure as code. So, using GitOps joins all these dots and allows you to deploy everything automatically just as Gitby worked out how he could automate his steps of baking the cake by putting down all the steps that occur and creating a documentation out of it. Similarly, at its core, GitOps is code-based infrastructure and operational procedures that rely on Git as a source control system. It is an evolution of infrastructure as code and it develops best practice that leverages Git as a single source of truth and control mechanism for creating, updating and deleting architecture. More simply, it is the practice of Git pull requests to verify and automatically deploy system infrastructure modifications. In addition to Git as a key DevOps mechanism, GitOps is used to describe tools that augment Git default functionalities. GitOps ensures that there is a systems cloud infrastructure is immediately reproducible based on the state of the Git repository, of course. And the pull request modify the state of the Git repository and once approved and merged, the pull request will automatically reconfigure and sync the live infrastructure to the state of the repository. This live-syncing pull request workflow is the core essence of GitOps. Now going back to our story, one fine morning the queen bee sent an order for a gigantic layered honey cake and scores of unicorn poop donuts. Granny bee who was used to manually baking and everything declared it was impossible to get the order completed because the timeline was very short. Queen bee wanted the order to be delivered by evening and that is when Git bee, our hero jumped in again. He buzzed around in enthusiasm and said, friends, I got another idea. Yet another idea? Yes. I'll automate everything and is set out to build a chain reaction machine. Wow. What was that? The machine was actually dictated by logic and physics and worked on the principles of cause and effect. And whoosh from mixing the ingredients to whipping the batter to molding the cake, baking, cooling it over, icing and garnishing. Everything was a part of the chain reaction machine. And if you folks are wondering what would that chain reaction machine look like? It is something like this. A cause and effect machine. You might have seen this. One thing leads to the another and that's how our hero Git bee devised a machine that would bake the cake and the unicorn poops that would be needed for delivering the queen's order. Similarly, GitOps is equal to infrastructure of code plus CICD. Now, GitOps uses Git repository as a single source of truth for infrastructure definitions. Now, using these concepts, we can build our own cause and effect machine just like it be a Git repository is a dot Git folder in a project that tracks all the changes made to the files in the project over time. Now, infrastructure as code is the practice of keeping all infrastructure configurations as code. The actual desired state may or may not be stored as code. Example, say if you're using Kubernetes, the number of replicas, pods and all those information may not be stored as code. And then you use the mechanism of merge requests and GitOps uses merge requests as the change mechanism for all the infrastructure. The MR is where teams can collaborate via reviews and comments and formal approvals take place. And finally, the merge commits to your master branch and then serves as a change log for auditing and troubleshooting in the future. And also, another component of GitOps is the CICD pipeline and GitOps automates infrastructure updates using a Git workflow and it incorporates continuous integration and continuous delivery. Now, when new code is merged, the CICD pipeline enacts the change in the environment and any configuration drift such as manual changes or errors is overwritten by GitOps automation. So, the environment converges on the desired state defined in Git. Now, this approach has a lot of benefits. The GitOps framework makes infrastructure automation possible and, while automation has a value in itself, it is not the only advantage of GitOps organizations that adopt. GitOps enjoy other benefits that can make a long-term impact. Since every change will go through the same change merge requests, reviews and comments, it is not the only advantage of GitOps. Now, the CICD pipeline is very flexible and while automation has a value in itself, it is not the only advantage of GitOps organizations that adopt. GitOps enjoy other benefits that can make a long-term impact. Since every change will go through the same change merge request review approval process, senior engineers can focus on other areas beyond critical infrastructure management. Now, improved access control is there. There is no need to give credentials to infrastructure components. So, they will just have to work on their Git repositories and all the other key-based authentications are separately configured so you don't have to individually share the configuration. So, there is less risk. All the changes are tracked through merge requests so you can keep an eye on the changes. Then, because this is all automated, it leads to a faster time to market. So, execution via code is faster than manual point and click. Test cases are automated and repeatable so stable environments can be delivered rapidly with GitOps and auditing is simplified. You have all the records in place and with GitOps all changes to environments are stored in the Git log making audit simple as I said and automation of the infrastructure definition and testing eliminates all the manual tasks that were being done. So, that's how GitOps helps and that's how it works. Now, going back to the story, the cause and the effect machine was a huge hit. It wasn't a simple machine though. It was a unison of multiple moving parts for specialized functions. It even had an option to declare the flavor color in gradient variants for each end product and using that machine the cakes were being baked faster and more efficiently. Now, GitOps tools are no different than the cause and effect machine that we saw some time ago this one. Well, what makes GitOps unique is that it's not a single product plugin or platform. GitOps is a framework that helps teams to manage IT infrastructure through processes that they already use in application development popular tools like Ansible, Terraform, Kubernetes and so on. But GitOps processes largely technology agnostic except for Git, of course, without it GitOps wouldn't exist. Now, GitOps is suited for a variety of scenarios. GitOps and Kubernetes is a particularly good match. For example, Kubernetes works on all major cloud platforms and uses stateless and immutable common GitOps tools and containers. Containerized apps running in Kubernetes are self-contained so you don't need to provision and configure services for each app. Provision Kubernetes clusters and other needed infrastructure like databases, networking, etc. using Terraform and you can deploy stateful applications with ease. Now, automating the workflow using automations and the cause and effect machine allowed GitOps to roll out hundreds of different recipes around the clock and his machine and his cake shop was a big hit. QueenBee personally congratulated GitBee for his efficient practices that led to faster delivery and consistency in the quality and comfort him the bee award. So what are the takeaways the best practices of GitOps? One of the main things is to document what you cannot automate if it's not always possible to automate everything because that's very important because half automation is more dangerous. Like if you're doing manually, you know you can do things manually. But if you have parts automated and parts manual, then documentation should be well written and you should work on ways to automate those steps that have yet not been automated. Now, the second thing is it is important to familiarize GitOps teams with Git and code reviews. Some teams already use a Git repository as a place to store config code, but don't use features like merge requests. As a starting point, take a look at the code review guidelines and try to induct the team into these practices. Once the teams are familiar with the tool and practices, implement mandatory reviews to ensure code reviews happen every week or every few days and always remember to keep these guidelines simple so that it is easy to follow and not work around it. And that's exactly what Git bee and grandma Lily did. So that's the end of our little analogy and beginning of your journey into GitOps. We don't have much time left today for a live demonstration. I would rather leave you with some useful repositories and resources that will help you pursue GitOps and try out the demos. There are demo links also. I'll be sharing that in the next slide so you can visit that repository and try out the steps and read the notes about GitOps that will help you work on GitOps. And you can reach me out anytime for any help if you need to get onboarded with DevOps and GitOps practices. In conclusion, GitOps is an incredibly powerful workflow pattern for managing modern cloud infrastructure. GitOps can bring many benefits to an engineering team including improved time to market, visibility, stability and system reliability. It allows you to be more productive as a developer, as a DevOps engineer and makes your finished product less prone to errors. Now back to the story, our little Git bees cake shop is now the most sought after in town and thanks to Git bees cause and effect machine and his declarative delivery pipeline and thanks to GitOps. To subscribe to my channel, reach me to learn more about DevOps on my email address and you can check out this repository at GitHub and learn more about GitOps practices. Thank you.