GitOps
The Rocket Pad Platform is a comprehensive development environment built on top of Kubernetes that empowers developers and operations teams to streamline application development, deployment, and management. A core principle guiding the Rocket Pad Platform's design is GitOps. This approach leverages Git, a popular version control system, as the single source of truth for managing both infrastructure and applications. Let's delve into the benefits of GitOps and how the Rocket Pad Platform implements these principles.
Why GitOps?
Traditional infrastructure management often relies on manual configurations, which can be error-prone and difficult to track. GitOps offers a more efficient and reliable alternative:
- Version Control and Collaboration: Git serves as the central repository for all infrastructure and application configurations (IaC manifests). This enables version control, allowing you to track changes, revert to previous configurations if needed, and collaborate effectively within development teams.
- Declarative Infrastructure: Infrastructure and applications are defined declaratively using IaC. This approach specifies the desired state of your infrastructure, rather than a series of steps to achieve that state. The Rocket Pad Platform translates these IaC definitions into actionable commands for Kubernetes, ensuring the actual state of your cluster always reflects the desired state defined in Git.
- Improved Reliability and Repeatability: IaC eliminates manual configuration errors, a leading cause of infrastructure inconsistencies and failures. Consistent infrastructure definitions across environments lead to a more reliable platform. IaC scripts can also be easily replicated and deployed across different environments, fostering reproducibility and streamlining deployments in new contexts.
- Simplified Disaster Recovery and Rollbacks: By treating infrastructure as code, IaC enables infrastructure rollbacks by simply reverting to a previous version control commit. Additionally, disaster recovery is streamlined as infrastructure definitions are readily available for rapid redeployment in a new environment, potentially even a different cloud provider.
By embracing GitOps principles, the Rocket Pad Platform delivers a robust foundation for efficient and reliable application development within your organization.
IaC: Infrastructure as Code in the Rocket Pad Platform
Our Rocket Pad Platform leverages Infrastructure as Code (IaC) with Terraform to automate infrastructure provisioning and management, adhering to GitOps principles. We support multiple cloud provider and even bare-metal deployments of our Platform trough Terraform IaC.
Overall, the combination of Terraform and GitOps empowers you to manage the IDP's infrastructure in a declarative, automated, and version-controlled manner. This simplifies platform deployments, fosters collaboration, and ensures a reliable and secure foundation for your development environment.
Terraform for Declarative IaC:
- Desired State Definition: Terraform allows developers to define the desired state of the IDP's infrastructure using configuration files written in HashiCorp Configuration Language (HCL). These files specify the resources required (e.g., Kubernetes clusters, virtual networks, load balancers) and their desired configurations.
- Multi-Cloud Support: Terraform offers a wide range of providers, allowing you to define infrastructure for various cloud providers or even bare-metal infrastructure. This aligns with the IDP's cloud-agnostic approach.
- Modularity and Reusability: Terraform configurations can be modular, enabling the creation of reusable code blocks for frequently used infrastructure components. This promotes code organization and simplifies infrastructure management.
GitOps Integration:
- Version Control and Collaboration: Terraform configuration files are stored in Git repositories. This enables version control, allowing for tracking changes, reverting to previous configurations if necessary, and fostering collaboration within development teams.
- Integration with Argo CD: Argo CD, the IDP's GitOps tool, can be configured to monitor Git repositories containing Terraform configurations. When a change is committed, Argo CD triggers a re-execution of the Terraform code, automatically provisioning or updating the infrastructure to reflect the desired state defined in Git.
Benefits of Terraform with GitOps for the IDP:
- Automated Infrastructure Rollouts: Terraform automates infrastructure provisioning based on the desired state defined in Git, eliminating manual configuration errors and streamlining deployments.
- Repeatable and Consistent Infrastructure: IaC ensures consistent infrastructure configurations across environments, leading to a more reliable platform foundation.
- Simplified Disaster Recovery: Infrastructure definitions stored in Git repositories act as a readily available backup. In case of a disaster, infrastructure can be quickly redeployed using the IaC code.
- Improved Security and Compliance: IaC allows for enforcing security best practices and compliance standards within your infrastructure definitions, reducing the risk of security vulnerabilities.
If you are deploying our Rocket Pad Platform with one of our terraform examples make sure to not manually change any components that where created during this process within your your provider trough the UI or other tools. Always define changes on this part of the infrastructure with terraform, so the terraform state will be in sync with your infrastructure. Otherwise when running the terraform script again to update the Rocket Pad Platform for example all the manual changes done to the cloud infrastructure will be reverted by terraform and reset to only what is defined in the terraform IaC.
Argo CD: Orchestrating GitOps Workflows in the Rocket Pad Platform
Argo CD plays a central role in implementing GitOps principles in to our Rocket Pad Platform . It acts as a continuous delivery tool that bridges the gap between your Git repositories and your Kubernetes cluster. Here's a breakdown of how Argo CD works and how it is configured and used within the Rocket Pad Platform:
1. Declarative Configuration: Developers define the desired state of their applications and infrastructure using standardized Kubernetes manifests stored in Git repositories. These manifests can be written in various formats like YAML, Helm charts, or Kustomize configurations. We leverage helm templates for application deployments in most cases. Internally our platform base uses Jsonnet to create the desired manifest files. But Jsonnet is not required to use our Platform.
2. Continuous Delivery: Argo CD facilitates continuous delivery by automating the deployment process. Whenever a change is committed to the Git repository, Argo CD triggers a new deployment, ensuring your applications are always running the latest version defined in the code.
3. Pull-Based Deployments: Unlike traditional push-based deployments where updates are directly pushed to the cluster, Argo CD operates in a pull-based manner. Upon detecting a change in the Git repository, Argo CD pulls the updated IaC definitions and analyzes them.
4. Continuous Monitoring: Argo CD acts as a Kubernetes controller, constantly monitoring configured Git repositories for changes. It watches for new commits or updates to the IaC manifests. This allows developers to monitor application states and rollouts easily over the Argo CD UI and let Argo CD handle the necessary changes in the cluster to reach the infrastructure state defined in GitOps repositories.
5. Desired vs. Actual State: Argo CD compares the desired state of the application or infrastructure defined in the IaC manifests with the actual state currently running in the Kubernetes cluster. This involves analyzing deployed resources like deployments, services, and configurations.
6. Automatic Reconciliation: If any discrepancies are found between the desired and actual state, Argo CD initiates the reconciliation process. It translates the IaC definitions into actionable commands for Kubernetes and applies the necessary changes to bring the cluster state into sync with the desired state defined in Git. This can involve creating new resources, updating existing ones, or deleting outdated configurations.
7. Rollbacks and Version Control: Since Git serves as the single source of truth, Argo CD leverages Git's version control capabilities. If an unintended consequence arises due to a deployment, you can easily rollback to a previous version of the IaC configuration stored in Git. This allows for easy recovery and experimentation within your deployments.
Argo CD provides a Revisions system and allows for rolling back to older revisions. But we recommend not using this feature and instead rollback your Git Source to provide Argo CD the older state of your deployment.
📄️ Argo CD and GitOps
Our {constants.productName} follows the GitOps principles and therefore uses Git repositories as its central configuration point. With this concept in mind the most important service in the {constants.productName} is Argo CD.