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.

Rancher Container Creation
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.

image-2022-04-04-14-50-03-768.png

Click on Cluster Management button. You'll be prompted with similar page shown below.


image-2022-04-04-14-58-59-869.png

There are two options to add clusters: Create or Import Existing. Select Create on the top right corner of the window.

image-2022-04-04-15-04-40-009.png

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.

image-2022-04-04-15-17-49-211.png

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.

image-2022-04-04-15-22-06-083.png

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.

image-2022-04-05-16-35-46-790.png

Rancher offers the possibility to import from several Kubernetes provider. However, the Generic option is used in this case.

image-2022-04-05-16-40-17-403.png

Add members, agent environment variables and labels & annotations if required by the user. After filling the necessary information, click on Create.

image-2022-04-05-16-42-50-168.png

If the certificates are self-signed in the cluster, copy the second command and execute it in the node were kubectl is installed.

image-2022-04-05-16-44-44-328.png

after the execution of the command, wait for the cattle-cluster-agent containers to be created. The cluster will join Rancher successfully.

cattle-cluster-agent pods
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
... 








  • No labels