In this tutorial , We will learn how to install and configure Rancher on Ubuntu 18.04.
Lets us see how to install Rancher and setup Local authentication.
Rancher is an open source container management platform built for organizations that deploy containers in production. Rancher makes it easy to run Kubernetes everywhere, meet IT requirements, and empower DevOps teams. Hi guys, Hope you are all well! I cannot deploy the latest rancher version on minikube (v1.15.1) on Ubuntu 18.04.3 LTS. Minikube start eval $(minikube docker-env) minikube addons enable ingress minikube addons enable ingress-dns helm re. The install is finished. Setup Rancher HA with Helm and Cert Manager. In this step we will install Rancher with certificates managed by Let’s encrypt. First we need to install the cert-manager with: $ helm install stable/cert-manager -name cert-manager -namespace kube-system -version v0.5.2. We can check the install status with. Run Windows Containers on Rancher on Windows Server in Hyper-V; Provision a Rancher Worker Node on Ubuntu in Hyper-V; Provision Rancher Nodes on WSL; Misc Scripts. To quickly reset k3s: rm -rf /etc/rancher/k3s rm -rf /var/lib/rancher/k3s. Quick setup if you need to start from scratch.
Docker must be installed on the server to run rancher.
First we need to install docker on Ubuntu , As the latest stable version of docker wont be there in the default repository.
We will add the latest stable repository of docker in the system.
Run the below command , to update the packages lists for upgrading the packages and also the new packages that was added to the respository.
Update the apt package index.
And install the below packages on the system to allow apt to use repositories over HTTPS.
Before installing the latest stable version of Docker on Ubuntu systems, First we need to remove older version of docker installed on the system, Using the below command.
It will delete the above listed packages and its dependencies.
Adding Docker’s official GPG Key.
verify the fingerprint of the key using the below command.
Lets add the stable repository to the system.
We have added the latest stable version of docker repository to the system.
We should update the apt index before using it.
And install the docker engine containerd packages.
If you wish to install the specific version of docker engine from the repository.First list the available versions in the repo and then run then we will install the specific version of docker.
You can find the lists of available versions of docker.
To install the specific version , Use can select the version string from the second column.
For example : 5:19.03.3~3-0~ubuntu-bionic
Lets install the above mentioned version using the below command.
If you are installing custom version of docker and If the docker is already present on the system , The above commands with either Upgrade or Downgrade the docker version depending on the currently installed version of Docker.
Once the docker is installed on the system.Start the docker service and enable it on system boot.
To check the status of the Docker,
We have installed the latest stable version of Docker engine and the Docker service is running fine.
To check the version of the installed Docker engine ,
As we have the docker installed in the system ,We can install Rancher as a docker container on the Ubuntu Host.
The above command will download the latest version of rancher docker image to the Ubuntu host machine.
Run the below command to list the available docker images in the system.
To check the running rancher container , Run the below command.
from the above screenshot , You can see that the rancher is listening on the port 8080.
You can access the Rancher portal using IP address or domain name followed by port 8080.
You will be greeted with the following screen.
What happened here is , We have accessed the Rancher portal without username and password , as the authentication is not configured yet.
Rancher supports various access control methods such as Active Directory , Azure AB , Local , GitHub , OpenLDAP and Shibboleth.
To setup an Authentication for Rancher access portal ,Under Admin click Access control
You will see the following page.
Click LOCAL , Provide the username and password to setup Admin user.
and then click Enable Local Auth.
If you can now login using username and password , which we configured as a Admin user.
You will see the following screen , While access http://ipaddress:8080
Provide the username and password and then you will be taken into rancher dashboard.
We have implemented Rancher on the Ubuntu operating system and also we have enabled Local authentication mechanism for the Portal.
Hope you find it helpful.Please do check out my other publications.
I’ve been learning a lot on Kubernetes these last couple months, and wanted to get my homelab setup to a point to makes deploying clusters easy and reliable. When I first started, I simply used minikube and docker on my desktop. However, the need for something more “robust” and “enterprise” quickly arose.
Being relatively new to Kubernetes (k8s), I first needed information. I’m in the middle of Kubernetes Fundamentals (LFS285) from LinuxFoundation.org. Additionally, I was lucky enough to have Nigel Poulton send a copy of The Kubernetes Book (Klingon Edition – seriously!) for finding the hidden Klingon in the “code” in the background of the book cover. These 2 resources will keep me busy for the rest of this year, as well as many blogs on various Linux, docker, and kubernetes steps I’ve found along the way.
Originally, I thought about using Raspberry Pi’s for my k8s lab, but realized that I didn’t want to be on ARM cpu. Since I already had a VMware homelab with plenty of space, using it made the most sense. I started by deploying 4 Ubuntu VMs and then using NFS storage for persistent storage in the cluster I created. It worked fine, but my NFS storage (Synology) didn’t support the ability to snapshot my persistent volumes.
Next, I used the same Ubuntu cluster, added a second disk to each VM, and deployed Ceph for my cluster’s persistent storage. Unfortunately, I kept running into issues and in the end, abandoned that approach.
Since I had just upgraded my VMware lab to vSphere 7, I decided to use the vSphere-CSI to provide persistent volumes to my cluster. Again, out of my depth, I found it hard to navigate getting the proper taints on my existing cluster, getting the VMware CPI installed, and getting the VMware CSI installed and setup within my cluster. This led to the final solution:
I deployed a single Ubuntu VM, and installed Rancher on it. Then, within rancher I setup a Node Template for vSphere using my Ubuntu Template. Rancher includes a VMware CPI & CSI app in the catalog to make deploying new clusters with all the requirements for consuming VMware storage very simple.
I wanted to have Rancher exist outside any clusters I would make, so using a single Ubuntu VM made sense. And since Rancher runs in docker, it also made deployment super easy. I simply followed Rancher’s single node Docker deployment instructions.
First, I Installed Ubuntu 18.04 LTS on a VM with 2vCPU and 4gb RAM and got it up to date:
Next, was installing Docker. Rancher provides a simple script, so I decided to save a little typing and use that.
Last, was using a simple docker run command to get Rancher going:
That was simple! At this point, All I have is Rancher running in Docker on an Ubuntu VM. Now, in order to get clusters dynamically provisioned, I would need to setup an Ubuntu Template that I can deploy more VMs from.
I decided to stick with Ubuntu 18.04 LTS, so I spun up a new VM with 2vCPU, 4gb RAM, and 16gb of disk. I setup the storage controller to be VMware Paravirtual since I will be using the vSphere CSI for storage inside my clusters.
I made sure to enable SSH during the install, and then once the server was ready, I logged in and ran updates.
Next, there are just a couple things we will need to do for Kubernetes to run properly on this. First is disabling swap and making sure it stays that way after a reboot.
Next, since I will be using DHCP in my environment instead of static IPs, I need to make sure that the Ubuntu VMs get unique addresses. Ubuntu doesn’t use the MAC address, but rather a machine id, and that’s generated during install. By running the following code, we can ensure a unique code every time we deploy from the template.
Finally, Rancher will use cloud-init to configure the VMs it deploys from out template, so we will want to install that as well.
At this point, I don’t want to reboot the server anymore, otherwise I’ll lose it’s “clean” state. I shut down the Ubuntu server, and right clicked and converted it to a template.
In the next blog post, I’ll setup a Node Template inside Rancher as well as add a Catalog App to make the VMware storage integration incredibly simple!