GCE allows you to run virtual machines on thousands of virtual CPUs that is designed to be fast and reliable for many types of workloads. GCE offers a number of different capabilities including block storage with varying levels of performance as well as networking that lets you scale and keep your applications connected. Read more here.
Flocker does a great job of orchestrating data volumes around a cluster of machines and automatically moving those volumes between nodes when your containers move.
GCE provides Flocker with the machines and persistent disks that it can manage automatically for you and your containers running on the machines.
Combining GCE infrastructure with a volume manager like Flocker gives you the ultimate flexibility for your persistent containerized workloads in a microservices environment.
The Flocker driver for GCE has the following features:
Support for account authentication (Both via VM and from authentication credentials).
Verified testing on large clusters.
Support for Flocker profiles (bronze, silver, gold) silver and gold are persistent disk on SSD, bronze is persistent disk on spinning disk.
You can read more about our integration with GCE and how to use it by visiting the GCE configuration documentation section of our docs. Feel free to reach out on IRC or send an email to firstname.lastname@example.org.
Here is an example demonstration of deploying Flocker 1.11 with Ansible onto GCE with the new GCE driver with Docker. Feel free to watch the following recording (no audio) if you want to see an example of what it is like to get started using Flocker on GCE or try yourself in the below step-by-step walk-through!
The first thing you will need to do is create a GCE account. At the time of writing this you can receive a $300 credit for 60 days on GCE.
Second, create a workspace on your local machine.
Pull down the demo repository from GitHub.
Install the gcloud command line tool. You can visit here for more on installing and downloading.
On a Mac, this can be achieved with the following commands.
You will need Python 2.7 and virtualenv installed (pip install virtualenv && pip install virtualenvwrapper) as well as flockerctl to interact with your cluster.
If you have a local Docker daemon, you can install flockerctl with the following command. You can also install directly to Mac OSX if you would like.
Next, login to GCE and set some environment variables.
Next, create a firewall and launch your instances.
Note, in the gcloud copmute instances create command, the --scopes https://www.googleapis.com/auth/compute flag is what gives our VMs permissions to create and delete volumes so we can skip adding specific credentials to the agent.yml.
Next, configure SSH to your VMs
There are many ways to install Flocker on a cluster of nodes, for the sake of this tutorial we are using Cluster HQ’s Ansible Galaxy role. If you already use Ansible Galaxy, this provides a nice way to install Flocker in your existing system. If you are not interested in using the Ansible role to install Flocker, you can read our installation docs on how to install Flocker and skip down to the steps after Ansible. The Ansible galaxy role simply automates some of the steps.
Install the requirements to set up a Flocker cluster using Ansible. This involves pip installing Flocker to get flocker-ca and ansible-galaxy, as well as getting the roles from Ansible galaxy to install Docker and Flocker on the nodes.
Here we go, install the needed tools from within your virtual environment.
Note: You can also install flocker-ca using another technique here instead of using pip to install the .whl.
Next, use the provided script in the repository to help create an inventory and agent.yml for Flocker.
Note: 18.104.22.168 are fake addresses, your IPs will look different.
Note: this is the exact agent.yml transfered to our VMs. Its no trick that we are not adding credentials to this dataset portion of the YAML becuase we used --scopes https://www.googleapis.com/auth/compute during our compute creation so we don’t need to.
Next, we can install Flocker on our GCE nodes using the Ansible playbook.
Note: if you see errors, you can try and re-run the Ansible playbook. If there are errors specifically around openssl or cryptography and you are on Mac OSX you will likely need to add LDFLAGS="-L/usr/local/opt/openssl/lib" as mentioned before when you pip install Flocker.
Next, you should be able to get the status of your Flocker cluster using flockerctl.
Next, we can create volumes and attach them to our nodes.
We can see our volume in our GCE Console as well.
You can also login to one of the GCE nodes and use Docker to create a volume.
Next, we can destroy our dataset and clean up our cluster.
Where to Go From Here
If you would like to use GCE with Flocker, again, you can visit our documentation to get started on how to do so.
We’d love to hear your feedback!
Google Compute EngineDocker (software)EngineGoogle (verb)