Run Your Apps on Kubernetes One Pull Request at a Time
Using GitOps to automate continuous application delivery has many business advantages. This getting started guide shows how to get started with only two commands.
Join the DZone community and get the full member experience.Join For Free
Building better software faster is the main driver of digital transformation. If you’re not rapidly deploying new features and fixes, your competitors are. Using GitOps to automate continuous application delivery brings a number of advantages to your business. This getting started guide shows how to get started with only two commands.
Automation frees up DevOps engineers' time to build great software and reduce the backlog. It guarantees consistency as services are deployed right the first time.
With Git as the single source of truth, configuration drift is not possible. Automation ensures nothing is missed, as soon as changes are merged into the monitored branch they are deployed. Weave GitOps Core is a free open source continuous delivery tool for Kubernetes with Flux (a CNCF incubating project) at its core. Think of it as a wrapper around Flux that automates and simplifies its initialization and operation. If you want to know more about the principles of GitOps, read the Weaveworks guide.
Once up and running, Weave GitOps Core continually reconciles the desired state, stored in GitHub, with the actual state, running in Kubernetes. Using GitHub as the single source of truth automatically gives you:
- Audit trail
- Review / Approval via Pull Request
- Compliance (privileged, run as root, permitted registries, etc.) via GitHub Actions
The reconciliation loop works both ways. A developer uses their regular workflow to update an application by editing a manifest file, updating an environment variable, or bumping an image version for example. Once that change is merged into the monitored branch in GitHub, typically main, that change is automatically applied to the Kubernetes cluster. Alternatively, if an ad-hoc change is made to the application with kubectl apply/edit, that change is automatically reverted to match the single source of truth in GitHub.
Weave GitOps Core accelerates Kubernetes application development by automating deployments and updates giving developer autonomy without burdening operations with requests. Not only does this automation save time, but it also guarantees consistency and repeatability. Using a versioned single source of truth, configuration drift is no longer a problem.
Try it yourself
Weave GitOps Core works with any Kubernetes cluster on your workstation or in the cloud:
- Kubernetes in Docker (kind)
- K3d / K3s
- AWS EKS
- Azure AKS
- Google GKE
$ cd my-github-repo $ gitops install $ gitops app add .
After a short while, your application will be deployed, you can keep an eye on the status of your applications with another simple command.
$ gitops app status my-app
Read the full getting started guide for more details. To see what Weave GitOps Core is doing on your cluster.
$ kubectl -n wego-system get pod
$ kubectl -n wego-system get crd
There are a number of Pods running that perform the reconciliation and some Custom Resource Definitions that define the entities those Pods work with.
Now you’ve worked through the getting started guide, the equivalent of a “Hello World” program, you’ve seen how a Weave GitOps Core enables you to build better code faster. The automation saves you time, guarantees consistency, eliminates configuration drift, and ensures nothing is missed.
You’re thinking this is sort of cool but my application environment is way more complicated than that. Don’t panic. Remember there’s Flux at its core which has all the sophistication required to handle multiple Kubernetes clusters and different environments such as test, staging, and production. Future posts in this series will go into more advanced use cases, so stay tuned.
Published at DZone with permission of Steve Waterworth. See the original article here.
Opinions expressed by DZone contributors are their own.