<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – GitOps</title>
    <link>https://www.devkuma.com/en/tags/gitops/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/gitops/logo/180x180.jpg</url>
      <title>GitOps</title>
      <link>https://www.devkuma.com/en/tags/gitops/</link>
    </image>
    <description>Recent content in GitOps on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/gitops/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>What is GitOps?</title>
      <link>https://www.devkuma.com/en/docs/git-ops/</link>
      <pubDate>Sun, 16 Apr 2023 02:56:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/git-ops/</guid>
      <description>
        
        
        &lt;h2 id=&#34;what-is-gitops&#34;&gt;What is GitOps?&lt;/h2&gt;
&lt;p&gt;GitOps is a term first used by Weaveworks Inc. in 2017 and is one of the practical approaches to DevOps in projects. It focuses especially on continuous deployment for cloud-native applications. As the name suggests, it means codifying every element related to application deployment and operations and managing those elements in Git.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/gitops1.png&#34; alt=&#34;GitOps&#34;&gt;
&lt;em&gt;Source: Weaveworks&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;GitOps is an operational framework that applies DevOps best practices used in application development, such as version control, collaboration, compliance, and CI/CD, to infrastructure automation.&lt;/p&gt;
&lt;p&gt;The essence of GitOps is the idea and method of managing the code for the entire system, including infrastructure and applications, with Git. GitOps uses the Git version control system to manage infrastructure configuration files such as IaC (Infrastructure as Code).&lt;/p&gt;
&lt;p&gt;Here, infrastructure generally assumes Kubernetes. Simply put, GitOps means managing Kubernetes manifest files in Git and deploying to the cluster with the manifests stored in Git.&lt;/p&gt;
&lt;h2 id=&#34;principles-of-gitops&#34;&gt;Principles of GitOps&lt;/h2&gt;
&lt;h3 id=&#34;every-system-should-be-declared-declaratively&#34;&gt;Every system should be declared declaratively.&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Declarative means the system is composed of facts, not a collection of commands.&lt;/li&gt;
&lt;li&gt;Kubernetes manifests are written declaratively. When they are managed in Git, they gain Git benefits such as versioning and provide a single source of truth (SSOT).&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;system-state-follows-the-version-in-git&#34;&gt;System state follows the version in Git.&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Because deployments use Kubernetes manifests stored in Git, you can deploy a previous system version with a command such as &lt;code&gt;git revert&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;approved-changes-are-applied-to-the-system-automatically&#34;&gt;Approved changes are applied to the system automatically.&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Once declared manifests are registered and managed in Git, every change, such as code modification, should be applied automatically to the system. Credentials should not be required each time deployment to a cluster is performed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;if-deployment-fails-users-should-be-alerted&#34;&gt;If deployment fails, users should be alerted.&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When system state is declared and kept under version control, a system should be prepared to alert users when deployment fails.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;benefits-of-gitops&#34;&gt;Benefits of GitOps&lt;/h2&gt;
&lt;p&gt;The benefits of GitOps can be summarized in four areas.&lt;/p&gt;
&lt;h3 id=&#34;productivity&#34;&gt;Productivity&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;When Git changes, the repository&amp;rsquo;s IaC settings change, making it possible to update Kubernetes clusters and manage features through Git.&lt;/li&gt;
&lt;li&gt;Operations through deployment can be handled through Git, and the production state can be compared with IaC in Git so differences can be detected and corrected.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;stability&#34;&gt;Stability&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Introducing a GitOps workflow makes it possible to automatically search audit logs for changes made externally to Kubernetes clusters.&lt;/li&gt;
&lt;li&gt;Because records remain for who did what and when, troubleshooting becomes easier.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;reliability&#34;&gt;Reliability&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;In manual infrastructure management, mistakes such as incorrect &lt;code&gt;kubectl apply&lt;/code&gt; targets can occur. GitOps avoids these mistakes. Rollbacks and other operations are managed through Git, enabling stable and reproducible operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;security&#34;&gt;Security&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Deployments with CI/CD tools often push to a cluster through &lt;code&gt;kubectl&lt;/code&gt;, requiring credentials to be exposed outside the cluster. This may be undesirable from a security perspective because CI and CD are not separated.&lt;/li&gt;
&lt;li&gt;GitOps separates and manages CI and CD. Because it uses Pull to change the cluster, credentials do not need to be exposed externally, reducing security risk.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;gitops-workflow&#34;&gt;GitOps Workflow&lt;/h2&gt;
&lt;p&gt;The following is a GitOps pipeline diagram introduced in the official Weaveworks blog.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/GitOps-pipeline.jpg&#34; alt=&#34;GitOps&#34;&gt;&lt;/p&gt;
&lt;p&gt;As the diagram shows, both CI and CD manage code in Git, but the CI and CD functions are separated.&lt;/p&gt;
&lt;h2 id=&#34;gitops-repository&#34;&gt;GitOps Repository&lt;/h2&gt;
&lt;p&gt;When designing a GitOps pipeline, it is generally recommended to use two Git repositories: one for application code and one for infrastructure environment configuration.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/Guide-To-GitOps-Diagrams6.png&#34; alt=&#34;Guide To GitOps Diagrams&#34;&gt;&lt;br&gt;
&lt;em&gt;Source: &lt;a href=&#34;https://www.gitops.tech/#push-based-deployments&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.gitops.tech/#push-based-deployments&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Application Repository (Git Code)
&lt;ul&gt;
&lt;li&gt;Includes application source code and deployment manifest files, such as Kubernetes YAML.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Repository for infrastructure environment configuration (Git Config)
&lt;ul&gt;
&lt;li&gt;Includes all manifests for the deployment environment, such as monitoring, services, and MQ, and defines which versions and configurations are used.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;gitops-deployment-strategies&#34;&gt;GitOps deployment strategies&lt;/h2&gt;
&lt;p&gt;GitOps has two deployment strategies: push-based pipelines and pull-based pipelines. The difference is how the manifests in the repository are matched with the state of the deployment environment. In general, pull-based deployment is considered safer from a security perspective and is preferred.&lt;/p&gt;
&lt;p&gt;Most CI/CD tools used recently use a push-based model. A push-based pipeline starts from code in the CI system and continuously pushes changes to a Kubernetes cluster through scripted paths, often using &lt;code&gt;kubectl&lt;/code&gt; directly.&lt;/p&gt;
&lt;p&gt;The reason not to use deployment functions in a CI system or manual command-line deployment is that credentials may be exposed outside the cluster. Although CI/CD scripts and command lines can be secured, they operate outside the cluster&amp;rsquo;s trust domain. This is generally not a good approach, and CI systems can become an external intrusion path into production.&lt;/p&gt;
&lt;h3 id=&#34;push-pipeline&#34;&gt;Push Pipeline&lt;/h3&gt;
&lt;p&gt;A push-based pipeline runs a deployment pipeline when manifest files in a Git repository change.&lt;br&gt;
&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/GitOps-push-type.png&#34; alt=&#34;Push Type&#34;&gt;&lt;br&gt;
&lt;em&gt;Source: &lt;a href=&#34;https://www.gitops.tech/#push-based-deployments&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.gitops.tech/#push-based-deployments&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;It is not affected by the number of deployment environments, and deployment environments can be added or changed simply by adding or modifying connection information. The architecture is simple, so it is used in many places.&lt;/p&gt;
&lt;p&gt;In general, a push pipeline has read/write permissions outside the cluster in CI, which can expose security information externally.&lt;br&gt;
&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/Guide-To-GitOps-Diagrams-Push-Pipeline.png&#34; alt=&#34;Guide To GitOps Diagrams&#34;&gt;&lt;br&gt;
&lt;em&gt;Source: &lt;a href=&#34;https://www.weave.works/technologies/gitops/#a-diy-gitops-pipeline&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.weave.works/technologies/gitops/#a-diy-gitops-pipeline&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&#34;pull-based-pipeline&#34;&gt;Pull based Pipeline&lt;/h3&gt;
&lt;p&gt;This structure uses a separate operator located in the target cluster to perform deployment.&lt;br&gt;
&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/GitOps-pull-type.png&#34; alt=&#34;Pull Type&#34;&gt;
&lt;em&gt;Source: &lt;a href=&#34;https://www.gitops.tech/#pull-based-deployments&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.gitops.tech/#pull-based-deployments&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The operator continuously compares the manifests in the Git repository with the deployment environment. When a difference occurs, it keeps the cluster aligned with the manifests in the Git repository.&lt;/p&gt;
&lt;p&gt;In a pull-based pipeline, the GitOps tool fetches images and credentials are kept inside the cluster, so security information is not exposed externally.&lt;br&gt;
&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/Guide-To-GitOps-Diagrams-Pull-based-Pipeline.png&#34; alt=&#34;Guide To GitOps Diagrams&#34;&gt;&lt;br&gt;
&lt;em&gt;Image: &lt;a href=&#34;https://www.weave.works/technologies/gitops/#a-diy-gitops-pipeline&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.weave.works/technologies/gitops/#a-diy-gitops-pipeline&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&#34;gitops-tools&#34;&gt;GitOps tools&lt;/h2&gt;
&lt;p&gt;There are three commonly used tools.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/git-ops/gitops-tools.png&#34; alt=&#34;GitOps tools&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;argo-cd&#34;&gt;Argo CD&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Argo CD provides an easy-to-understand GUI.
&lt;ul&gt;
&lt;li&gt;All operations, such as manual sync, can be performed from the GUI.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Related sites
&lt;ul&gt;
&lt;li&gt;Source code: &lt;a href=&#34;https://github.com/argoproj/argo-cd/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/argoproj/argo-cd/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Documentation: &lt;a href=&#34;https://argo-cd.readthedocs.io/en/stable/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://argo-cd.readthedocs.io/en/stable/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;flux-cd&#34;&gt;Flux CD&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A tool from Weaveworks, which proposed GitOps. It is simple and lightweight, but does not provide a GUI.&lt;/li&gt;
&lt;li&gt;Related sites
&lt;ul&gt;
&lt;li&gt;Source code: &lt;a href=&#34;https://github.com/fluxcd/flux2&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/fluxcd/flux2&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Documentation: &lt;a href=&#34;https://fluxcd.io/flux/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://fluxcd.io/flux/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;jenkins-x&#34;&gt;Jenkins X&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A tool derived from Jenkins. It can build CI/CD-capable pipelines themselves.
&lt;ul&gt;
&lt;li&gt;Argo CD and Flux CD handle only CD.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It is highly flexible, but its architecture is complex, so the learning cost is also high.&lt;/li&gt;
&lt;li&gt;Related sites
&lt;ul&gt;
&lt;li&gt;Source code: &lt;a href=&#34;https://github.com/jenkins-x/jx-cli&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/jenkins-x/jx-cli&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Documentation: &lt;a href=&#34;https://jenkins-x.io/v3/about/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://jenkins-x.io/v3/about/&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.gitops.tech/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;GitOps | GitOps is Continuous Deployment for cloud native applications&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.weave.works/technologies/gitops/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Guide To GitOps | Weaveworks&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>GitOps</category>
      
    </item>
    
  </channel>
</rss>
