Recently I was playing with the open-source release of Spinnaker, the continuous delivery tool that we use inside of Netflix. Spinnaker is designed for deploying apps on cloud backends (e.g., AWS, GCE), but I wanted to run everything entirely on my MacBook Pro.
Here’s how I set it up.
Prereqs
This uses Docker for running Spinnaker, and Kubernetes for the backend. The simplest way to get Docker and Kubernetes running on your local machine is:
- Install Docker for Mac
- Install corectl.app
- Install Kubernetes Solo cluster for macOS
Once all of these apps have been installed and running, you should have a Docker icon, Corectl icon, and Kube-Solo icon in your menu bar.
Verify that Kubernetes is running by clicking on the Kube-Solo icon and choosing “Kubernetes Dashboard”
Increase Docker memory
I had to increase the amount of memory in the Docker configuration to get Spinnaker working properly. I set mine to 8GB.
- Click on the Docker app in the menu bar
- Click the “Preferences” menu option
- Choose the amount of memory (8GB worked for me).
- Click “Apply & Restart”
Docker hub account
You will also need an account on Docker Hub, since we will configure Spinnaker to use Docker Hub as our image registry, and Spinnaker needs to know what your Docker Hub credentials are to download container images.
Grab the Spinnaker source
We will run Spinnaker from containers that have been previously uploaded to the Quay container registry, but we need the local code because it contains the Docker compose config files that we will use to run Spinnaker.
$ git clone https://github.com/spinnaker/spinnaker.git
$ cd spinnaker
Copy your kubeconfig file to config directory
Spinnaker requires your kubeconfig file which tells it how to connect to your Kubernetes deployment.
$ cp ~/kube-solo/kube/kubeconfig config/kubeconfig
The experimental/docker-compose/docker-compose.override.yml
file is configured by default to mount the config directory into the clouddriver container as /opt/spinnaker/config
.
Edit config/clouddriver.yml
In the Spinnaker repository that you just checked out, the config/clouddriver.yml
file contains configuration for the backend cloud providers that Spinnaker uses. We need to configure it for Kubernetes and for the Docker registry.
Here’s how I configured mine, by modifying the kubernetes
and dockerRegistry
fields.
kubernetes:
enabled: true
accounts:
- name: kubesolo
kubeconfigFile: /opt/spinnaker/config/kubeconfig
dockerRegistries:
- accountName: docker-hub
dockerRegistry:
enabled: true
accounts:
- name: docker-hub
address: https://index.docker.io
username: your-docker-hub-username-goes-here
password: your-docker-hub-password-goes-here
repositories:
- library/nginx
The example above will only allow you to run containers from the nginx repository. In a real deployment, you’d add more repositories, but nginx containers are just fine for local testing.
Start up Spinnaker using Docker Compose
Switch to the directory that contains the Docker Compose config files and start up all of the Spinnaker containers:
$ cd experimental/docker-compose
$ DOCKER_IP=localhost docker-compose up -d
It will take a few minutes for Spinnaker to come up.
Open Spinnaker in your browser
Docker Compose is configured to expose the Spinnaker web UI at http://localhost:9000.
Next, you can check out the Kubernetes Source To Prod code lab on the Spinnaker website for how to launch an app.
The docker registry config is like this because docker hub doesn’t allow you to poll its v2/catalog endpoint. If you have your own docker registry set up and it is compatible with v2, it will be able to scan all your images and fire off an event when a new tag is pushed.