How Deploy Works

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:

  1. Watching container image registries for new images.
  2. 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.
  3. During a release, the Kubernetes manifests are updated with the latest images and the changes committed to source control.
  4. 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 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 Begin

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.

Deploying Apps in Weave Cloud

To configure the Deploy feature in Weave Cloud:

1. Sign up with Weave Cloud, and create an instance and give it a name.

2. If you haven’t already completed this step, launch the fluxd daemon with the following. You will need to supply the token for your instance, and the git URL for your configuration repository, e.g., git@github.com:weaveworks/flux-example.

TOKEN=<WEAVE_CLOUD_TOKEN>
GIT_URL="git@github.com:<YOUR_GITHUB_USERNAME>/<YOUR_GITHUB_REPO>"
kubectl apply -n kube-system -f \
   "https://cloud.weave.works/k8s/flux?service-token=$TOKEN&git-url=$GIT_URL&k8s-version=$(kubectl version | base64 | tr -d '\n')"

This command launches the fluxd daemon only. To launch all three agents all at once, see Installing Agents.

If you’ve mistyped and you need to re-apply the Kubernetes Weave Cloud agents’ manifest run the following to first remove the agents (this command removes all of the agents installed):

kubectl delete -n kube-system \
  -f "https://cloud.weave.works/k8s/v1.6/weave-cloud?t=anything"

3. If you have configured Explore, you can check it to see that the fluxd is running as a container. To simplify this, enter flux into the search field in Explore

4. Install the generated public key to the Github repo with your manifests (that you specified above). fluxd uses the generated private key in order to write changes back to the repo.

If you are using Github and you have connected your Weave Cloud account to your Github account, you can click the button to install the public key.

If you have not connected your Github account, install the public key shown by going to the repo that contain your manifests in Github and clicking on “Settings”, then “Deploy Keys”, and creating a new key with read/write access. Enabling write access ensures that fluxd can push commits to your repository.

If you are not using Github, the method of installing the public key will vary. See for example, the GitLab documentation on using SSH keys.

5. For Slack integration, 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.

Further Reading