Hello good people. This guide will cover the installation and usage of Rancher container management platform on Ubuntu 18.04 LTS. Rancher is an open source, production ready, complete container management platform developed by Rancher Labs.
Rancher natively supports Kubernetes and allows users to control its features through a simple and intuitive UI. Kubernetes can be launched in a matter of minutes with a single click through Rancher. It integrates with LDAP, AD, and GitHub for authentication.
Similar: How to setup 3 node Kubernetes Cluster on Ubuntu 18.04 with Weave Net CNI
Rancher also provides Application catalog with over 90 popular Docker applications where you can deploy and manage complex applications with a click of a button. If you’re a Helm user, then no worry as Rancher ships with it. Additionally, it’s easy to update Kubernetes to latest stable release using its Rancher UI.
Install Rancher on Ubuntu 18.04
Here is the installation process of Rancher on Ubuntu 18.04. After the installation, we will deploy a Kubernetes cluster and create a test application container.
This setup has two VMs
Rancher Node: 192.168.18.60 Worker Node: 192.168.18.61
Step 1: Install Docker on Ubuntu 18.04 ( Both rancher server and worker node)
As Rancher and all workloads run on Docker containers, you need to have docker engine installed on your server
Update system apt index
sudo apt update
Then install the latest release of docker from the repository
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get -y install docker-ce
Wait for the download and installation of packages to finish then check docker version installed.
# docker version Client: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:24:51 2018 OS/Arch: linux/amd64 Experimental: false Server: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:23:15 2018 OS/Arch: linux/amd64 Experimental: false
You can also install an experimental release of docker using the script provided by Docker.
curl -fsSL get.docker.com -o get-docker.sh chmod +x get-docker.sh sudo ./get-docker.sh sudo usermod -aG docker $USER
Step 2: Create a Rancher docker container ( On Rancher Node)
Next, create a new Rancher server container by running the command:
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
If you have ports 80 & 443 used in your host system by other applications, you can map to different ports like below
sudo docker run -d --restart=unless-stopped -p 8080:80 -p 8443:443 rancher/rancher
The Rancher user interface can be accessed at https://<server_ip>.
On accessing the page, you’ll be asked to set a strong password for the default admin user.
Then set Rancher URL
Step 3: Create a Kubernetes Cluster
Here we’ll create a single node Kubernetes cluster, note that in a Production environment, you’ll need at least three nodes, one master node, and two worker nodes.
To create a new cluster, navigate to Clusters > Add Cluster > From my own existing nodes ( Custom). Give the cluster a name, and click “Next”. Under Node Options, choose all ( etcd, Control Plane, and Worker)
Paste the commands given on the Worker node. It may take some time for the cluster to be ready, so be patient.
Once the cluster is ready, all components should be green.
Step 4: Deploy Container application
Now that we have our cluster ready, let’s proceed to deploy a test application to it. Click on your cluster name, then Catalog Apps. Search the name of the application you want to deploy, for me this is Dokuwiki. Check the Application deployment details to know the changes you may need to make.
After deployment, the application should appear on the Workloads section.
Stay tuned for more articles related to Docker and Kubernetes.