Rancher provisions compute nodes and installs Kubernetes on them. It can manage multiple Kubernetes clusters from the same user interface. This guide shows how to deploy a Rancher server, and create a new Kubernetes cluster or importing an existing one.
Rancher Installation with Rancher-generated Self-Signed certificates
There are several SSL options for Rancher installation. However, Rancher-generated Self-Signed certificates were chosen in this task. The following command was executed to run Rancher server container.
docker run -d --restart=unless-stopped \ -p 80:80 -p 443:443 \ --privileged \ rancher/rancher:latest
Cluster deployment with Rancher
Make sure that the machine running the server has a Floation IP and has a rule that allows ingress to 443 port. When that's done visit the server through the browser https://<Floating IP>. Then, click on the global view button that marked below.
Click on Cluster Management button. You'll be prompted with similar page shown below.
There are two options to add clusters: Create or Import Existing. Select Create on the top right corner of the window.
Rancher provides multiple deployment methods depending on the Kubernetes/Cloud provider. In this case, the Custom option is used to Kubernetes create the cluster of OpenStack instances.
The user is able to configure in detailed manner the cluster before its deployment. After choosing the desirable options, click on Next that appears at the end of the page.
Choose role/s for each node that will join the cluster then copy and paste the shown docker command on the above image. The node may take up to 7 minutes to populate the required containers for creating/joining the cluster.
After the creation of the control plane and at least a worker and establishing the communication between Rancher components and the Kubernetes API server, cluster will appear as Active.
Importing Existing Cluster
It is possible to import clusters even if they were not created by any of the Rancher tools. To do so, click on import existing button in the Cluster Management page.
Rancher offers the possibility to import from several Kubernetes provider. However, the Generic option is used in this case.
Add members, agent environment variables and labels & annotations if required by the user. After filling the necessary information, click on Create.
If the certificates are self-signed in the cluster, copy the second command and execute it in the node were kubectl is installed.
after the execution of the command, wait for the cattle-cluster-agent containers to be created. The cluster will join Rancher successfully.
kubectl get pods -A ... cattle-system cattle-cluster-agent-56cdf577ff-lpf7z 1/1 Running 0 34s cattle-system cattle-cluster-agent-7f44bc68bd-589wd 1/1 Running 0 78s cattle-system cattle-cluster-agent-7f44bc68bd-djv9g 1/1 Running 0 77 ...