Skip to content

Instantly share code, notes, and snippets.

@CalvinHartwell
Last active February 8, 2018 13:48
Show Gist options
  • Select an option

  • Save CalvinHartwell/363bd7a4b4f5e73f922bf4bc2993e621 to your computer and use it in GitHub Desktop.

Select an option

Save CalvinHartwell/363bd7a4b4f5e73f922bf4bc2993e621 to your computer and use it in GitHub Desktop.
Running Rancher with Canonical Kubernetes (CDK) or another existing Kubernetes Cluster

Rancher on Canonical's Distribution of Kubernetes (CDK)

This document describes how to deploy Rancher and import an existing Kubernetes cluster. In our case, we assume you have already deployed CDK, Canonical's Kubernetes Distribution Running on Ubuntu. This can be on AWS, VMware, OpenStack, Azure or on bare metal.

If you run into issues or need support please comment on this Gist and email [email protected].

Install and deploy Canonical Kubernetes using Juju

To do this, deploy an Ubuntu machine, snap install juju and run a few commands:

sudo snap install juju
juju bootstrap 
juju deploy canonical-kubernetes

Note: depending on the cloud provider you use with juju, you might need to add additional configuration files. For example for AWs you should create an AWS credentials file in your home directory.

Deploy Rancher Workload on Top of Kubernetes

Once the Kubernetes cluster is up and running, we first create a manifest for Rancher:

wget https://gist.githubusercontent.com/CalvinHartwell/749460a8d59cf879220a36e2248b44d9/raw/36e574a19ca62ff523cc6aa0c41702e84a2344e0/rancher.yaml -O cdk-rancher.yaml

Note: within this k8s manifest, the ingress URL should be changed (rancher..xip.io). You can either edit the file manually before using kubectl apply or use the command 'kubectl edit ingress rancher' to change the ingress rule.

Also, we are pulling the latest version of Rancher which is 2.0alpha as of this writing. We need version 2.0 of Rancher to import an existing Kubernetes cluster. To pull this version, we used the Rancher Container 'rancher/server:master' instead of 'rancher/server:stable' or 'rancher/server:latest' which would be a better option in the future once version 2.0 is marked stable.

I would checking the latest releases for rancher when running through this tutorial: https://hub.docker.com/r/rancher/server/tags/.

Next we deploy Rancher on-top (example manifest):

kubectl apply -f cdk-rancher.yaml

Once deployed, we can now access the Rancher web gui on the URL you defined as part of the ingress rule (for example http://rancher.52.50.195.132.xip.io). Note, if something is wrong during deployment, you can check the logs for the container by running these commands:

 kubectl get po
 kubectl logs <rancher-pod-id>

Post-deployment Configuration

Once you're on the Rancher Web GUI we need to configure it to use our existing Kubernetes cluster.

 WIP.

Notes & Links

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