With Weave Cloud Deploy, developers on your team can make code changes to the app and then automatically deploy the app 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 a container image registry for changes.
- Deploying images (microservices) 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 and version controled with the latest images.
- Changes are then applied to the cluster.
This deployment pipeline automates an otherwise manual and error-prone two-step 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 applications 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 manages the 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 however can be carried out in the Weave Cloud GUI. The
fluxctlbinaries are installed onto your master node of the Kubernetes cluster.
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 Configuring 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 the Kubernetes manifests are in the same directory as your code. For information and advice on setting up your manifests see, Structuring the Configuration Repository
- Connect your continuous integration system and a container registry together and that they are referenced in your manifests properly.
- If you are using a private Container Image registry, have your authentication details ready.
- Deploy your application to a Kubernetes cluster and have it running.
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.
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:
kubectl apply -n kube-system -f \ https://cloud.weave.works/k8s/flux?service-token=[cloud-token]-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=?t=anything"
3. Check Explore to see that the
fluxd is running as a container. To simplify this, enter
flux agent into the search field in Explore
4. Click on Deploy and then select Configuration.
Enter the path to your Github repo and the path to the Kubernetes manifests in the following format:
firstname.lastname@example.org:user/repo-name / [path to Kubernetes manifests]: [branch]
The branch represents the current branch that you and your team are working from and which you will be merging and building from.
Note: The Kubernetes manifests must be in the same repository as your code.
5. Generate and push a set of SSH keys to the Github repo with your manifests that you specified above. Weave Cloud needs this access in order to write changes back to the repo.
Important! When pushing the keys to your repo, ensure that it is enabled to write.
Check that the keys are properly in Github by going to the repo that contain your manifests in Github and click on Settings and then Deploy Keys to ensure that your keys have read/write enabled. Enabling write access ensures that Weave Cloud has push access to your repository.
6. If you are using a Private Container Image registry, then click Add Credentials and enter the path to the image registry and then the username and password (this is the robot token if you are using Quay.io and if you are using Docker, then it is the 64-bit Docker password) into the dialog that appears. If you are using a public registry then there are no other configuration options necessary.
7. 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.
8. Log onto the master node on your Kubernetes cluster and deploy your application (if you haven’t already done so).
Note: Your application must be deployed and already running in a Kubernetes cluster before you can see your images in Deploy.