Skip to content

Instantly share code, notes, and snippets.

@displague
Last active January 18, 2019 03:52
Show Gist options
  • Save displague/286b91502b84ebf0d4072d97b8417435 to your computer and use it in GitHub Desktop.
Save displague/286b91502b84ebf0d4072d97b8417435 to your computer and use it in GitHub Desktop.
Trying Rancher on Linode

In this attempt, we will:

  1. Use Docker-Machine-Driver-Linode to provision a Linode with Docker-CE
  2. Run Rancher 2.x in that Docker-CE
  3. Install the Docker-Machine-Driver-Linode binary in Rancher
  4. Create a Template with the Necessary Settings
  5. Create a Rancher Kubernetes Cluster a. First Try Ubuntu (failure) b. Then Try CoreOS
  6. Next Steps

Use Docker-Machine-Driver-Linode to provision a Linode with Docker-CE

Install the docker-machine-driver-linode binary from https://github.com/linode/docker-machine-driver-linode/releases

Be sure to grab the appropriate binary for your operating system.

$ docker-machine create -d linode --linode-token $LINODE_TOKEN --linode-root-pass $(openssl rand -base64 32) dockode
Running pre-create checks...
Creating machine...
(dockode) Creating Linode machine instance...
(dockode) Creating linode instance
(dockode) Waiting for Machine Running...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env dockode

Now configure this as the backend for the Docker commands to follow.

$ eval $(docker-machine env dockode)

Run Rancher on the Linode (using the local Docker client)

Launch Rancher.

docker run -d -p 80:80 -p 443:443 rancher/rancher

Access port 443 on the Linode running docker and accept the certificate.

open https://$(docker-machine ip dockode):443/

Install the Docker-Machine-Driver-Linode binary in Rancher

Use the Latest Linode Docker Machine for Linux binary from the Github Releases:

https://github.com/linode/docker-machine-driver-linode/releases/download/v0.1.0/docker-machine-driver-linode_linux-amd64.zip

Use the Latest release of the Linode UI for Rancher:

https://github.com/displague/ui-driver-linode/releases/download/v0.1.0/component.js

Omitting this step will reveal all Docker Machine Driver options. Here be dragons. You'll want to provide the Region, Image, and Instance Type using the APIv4 IDs. You'll also need to provide a Root Pass, SSH User (core for containerlinux, root for everything else).

image

Create a Template with the Necessary Settings

image

image image

Create a Rancher Kubernetes Cluster

First Try Ubuntu (failure)

image image image image

Then Try CoreOS

image image

image

image

This cluster is currently Provisioning; areas that interact directly with it will not be available until the API is ready.
[pre-deploy] Pulling image [rancher/hyperkube:v1.11.3-rancher1] on host [192.155.90.133]
This cluster is currently Provisioning; areas that interact directly with it will not be available until the API is ready.
[addons] Saving addon ConfigMap to Kubernetes
Failed to get Kubernetes server version: Get https://173.255.238.177:6443/version: can not build dialer to c-qm8ln:m-2pbwc

Reduce the cluster count to 1 node. It works!

image image

But after a few minutes, ContainerLinux will reboot. And the Kubernetes services will not restart.

This cluster is currently Unavailable; areas that interact directly with it will not be available until the API is ready.
Failed to communicate with API server: Get https://45.33.66.78:6443/api/v1/componentstatuses?timeout=30s: waiting for cluster agent to connect

Next Steps

Fix https://github.com/displague/ui-driver-linode so that the Rancher UI can present drop downs with human values instead of raw Linode API values (Region, Kernel, Instance Type, Image dropdowns)

@displague
Copy link
Author

-v /var/lib/rancher:/opt/rancher (second one is the local directory) ..
also, use rancher/rancher:v2.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment