This extension is for Kubernetes application developers and operators. It provides a simple way to get started with GitOps and the CNCF project, Flux.
IMPORTANT!: this extension is at an early alpha stage of development! Please hold off on rating us and first submit bugs, issues and feature requests at github.com/weaveworks/vscode-gitops-tools
We would appreciate it very much. Thanks!! ❤️🧸
This guide and other GitOps and Flux documentation is always accesible via the DOCUMENTATION view:
GitOps is a process framework for working with applications and their infrastructure as code. Although GitOps does not require Git or Kubernetes, most people today practice GitOps with the two technologies and that is what we cover here. Git is an increasingly popular version controlling software and Kubernetes is a container orchestration system - both are open source. Flux is an open source project in the Cloud Native Computing Foundation (CNCF) that makes the GitOps magic happen with these technologies. This extension for VS Code will help you do this!
High level: With GitOps, you have a manigitfest in a repo (usually a .yaml file), and that manifest is the single source of truth for the state of your cluster. It defines how your cluster should look. Flux and Kubernetes work together to check on that manifest and to reconcile the cluster to match the indications automatically. That means that if anyone hacks into the system and makes a change to the cluster, Flux will “reset” it to what's in the YAML file. This adds security to your operations. Similarly, if you want to make a change to your cluster, you make changes to the YAML file and Flux and Kubernetes will reconcile the changes. Since the YAML files are in a Git repository there's an audit trail.>
With GitOps, developers commit their Kubernetes infrastructure definitions into the Git source control system so that the whole system is version controlled. Changes to the application infrastructure are accomplished by changing manifests and pushing that to a git repository. Changes are continuously reconciled from the git repository to the cluster.
Flux is software that enables GitOps. The core of Flux is GitOps Tools - a set of Kubernetes controllers and resources that work together to:
This GitOps Extension will allow you to set up a simple GitOps process with Flux and to observe it in action. (If this is your first time experiencing GitOps, we hope that your mind will be blown a little and rest assured that this journey can be taken slowly, and with great benefits along the way!)
This extension also helps to quickly inspect and debug existing Flux installations in your clusters. If you’re an application developer, this will enable you to version, reproduce, revert and share your cluster infrastructure changes through git - which improves collaboration and makes it easier to track infrastructure problems.
First, select a cluster and Enable GitOps
Next, you need a git repository for your infrastructure. If you don’t have one, you can fork the demo repository stefanprodan/podinfo [https://github.com/stefanprodan/podinfo]
GitRepository (Create Source)Tell Flux about your infrastructure git repository. In this example the default repo stefanprodan/podinfo is used:
Once the GitRepository is created, Flux will fetch the latest commit (“reconcile”) from the git server:
GitRepositoryNow that Flux knows about the repo, let’s tell it how the repo defines our infrastructure. We must provide a folder path from where the cluster manifests will be continuously synced. Since Flux uses Kustomize configuration management system, this configuration is stored in a resource type Kustomization
Next let's add a Kustomization our GitRepository podinfo:
The setup is done! We can see the Kustomization podinfo and all the resources that were created:
Now any changes you commit to the repository podinfo ./kustomize folder will be reflected in the cluster. By default Flux reconciles the cluster every minute. If you don’t want to wait, you can trigger it manually or configure a webhook receiver.
Both the GitRepository and Kustomization are reconciled to apply your changes from the github repository. Reconciling GitRepository tells Flux to fetch the latest commit from github while reconciling the Kustomization will apply manifests from the latest commit.
You can troubleshoot problems by right-clicking on a controller in Clusters view and selecting ‘Show Logs’
You can also right-click Workloads and select ‘Trace’ to understand the origin of resources managed by Flux
Congrats! Hopefully, this helps you to get a sense of GitOps if this is your first time. If you have any questions about GitOps, Flux, or this extension, please post an issue: github.com/weaveworks/vscode-gitops-tools/issues You can chat with us in Slack as well. To invite yourself visit slack.weave.works and join #vscode-gitops