Deploying in a GitOps world
The Deploy feature in Weave Cloud will help you implement the GitOps pattern in your organisation very easily. This will allow your dev teams to go much faster. Among the benefits are:
- Git as a single source of truth.
- Infrastructure and applications are declarative: desired and observed state, can programmatically be compared.
- Simple deployments with a secure CI/CD pipeline.
- Observability tools, simple rollbacks.
With Weave Cloud Deploy, developers on your team can make code or configuration changes to your app and have them automatically deployed to a Kubernetes cluster. Weave Cloud maintains a best practices approach by version controlling the Kubernetes manifests, and by modifying them to include all pushed Docker image versions. This allows development teams to make rapid and less error-prone code changes.
Weave Cloud does this by:
- Watching container image registries for new images.
- Deploying new images based on a “manual deployment” or an “automatic deployment” policy. Policies can be modified on a service by service basis by selecting Automate. If Weave Cloud deploy is configured to automatically deploy a change, it proceeds immediately. If not, it waits for you to press Release.
- During a release, the Kubernetes manifests are updated with the latest images and the changes committed to source control.
- Changes are then synchronized to the cluster.
This deployment pipeline automates an otherwise manual and error-prone process by automating the application deployment and version controlling your manifests, in a single step.
Important! Weave Cloud supports pushing to a single config repository only. Multiple application configurations on the same cluster can be supported by creating and configuring multiple instances of Weave Cloud Deploy.
At present, the Deploy feature of Weave Cloud supports Kubernetes deployments only.
Weave Cloud Deploy consists of the following components:
- fluxd – (required installation) a daemon process that runs tasks on behalf of the hosted service. The daemon keeps track of deployments, updates the manifests for your services and also keeps track of Docker images.
- fluxctl– (optional) a command line utility that allows you to control the daemon.
Most common tasks can be carried out in the Weave Cloud GUI and do not need
fluxctl. The command line utility is useful however for more fine-grained procedures and for troubleshooting deployments. It is not necessary to use the command line utility with Weave Cloud. See Deploy Command Line Options for information about using
fluxctl and see also Using Deploy on the Command Line if you prefer to skip the GUI altogether and just use the command line.
Before you configure Deploy to work with your development environment:
- Ensure your Kubernetes manifests are in source control (e.g., a Github repository). For information and advice on setting up your manifests, see Structuring the Configuration Repository
- Optionally, if you are using continuous integration, push your container images to the container registry as part of the CI build.
Note: If you are not ready to deploy your own code to Weave Cloud, try out one of our Interactive Labs. There are no downloads required and it works in the browser in a real terminal.
Configuring deploy is a two step process:
- First install the Weave Cloud agents by following the setup screens and then copying the command and running it on your cluster.
- Then you’ll need to complete the deploy configuration by providing your repo, path to the manifests and a tag and then by copying and running the resulting command in your cluster. (Additionally, these steps also has added bonus of automatically deploying your app to the cluster.)
To complete the Deploy configuration in Weave Cloud and to automatically deploy your app:
2. Next, select the Cog icon from the header and then click Deploy→ Config and then fill in the following fields:
- Git Config Repository
Add the complete path the git repository, the full path to your Kubernetes manifests and to the tag you want to deploy.
Run the command that appears against your cluster. (This command launches the
Git Repository Write Permissions – Push your SSH keys to the repo.
Slack Account – add an “Incoming Webhook” to Slack, and then copy the webhook URL to the Deploy set up dialog. You can also optionally override the username used by Slack when posting messages, and choose which events you want to be notified of.
If you’ve mistyped and you need to re-apply the Kubernetes agents manifest run the following (this command removes all of the agents installed, and as a result, you’ll have to go back to the setup screens to reinstall all agents and then the fluxd daemon):
kubectl delete ns weave
3. After a few moments, your app will appear in Explore and you will also be able to see the services in Deploy. This may take a few minutes, depending on how large your app is.