Nội dung
I. What is Rancher?
Rancher is an open source Kubernetes management platform that has been in development since 2014. It provides an easy-to-use graphical interface for deploying, managing, and operating Kubernetes clusters. Rancher allows users to deploy Kubernetes across a variety of environments, including on-premises servers, public and private clouds, and cloud-based Kubernetes clusters.
Rancher also integrates some useful tools for System Admin such as Shell, App Catalog,…
System requirements:
- A server or virtual machine running Linux. Rancher supports Linux distributions such as Ubuntu , CentOS , Red Hat Enterprise Linux (RHEL) , and SUSE Linux Enterprise Server (SLES) .
- Have at least 4GB of RAM.
- Docker is installed. Rancher uses Docker to run containers.
II. Install Rancher.
To install Rancher, you can follow these steps:
Step 1: Install Docker.
First, you need to install Docker on your server. You can see detailed instructions on how to install Docker on Ubuntu 22.04 below.
Step 2: Download Rancher Docker Image.
Once you have installed Docker, use the following command to download the Rancher Docker image to the server.
sudo docker pull rancher/rancher:latest
Step 3: Run Rancher Container.
Once the Rancher Docker image download is complete, use the following command to check the image.
docker image ls
So the Rancher image has been downloaded, next you use the following command to run the Rancher container:
sudo docker run --privileged -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:latest
Note:
- –privileged: To make Rancher available when running outside of Kubernetes.
- -d: Is an option of docker run, it allows the container to run in detach mode, which means the container will run in the background and not be associated with the current terminal.
- –restart=unless-stopped: Another docker run option, to specify how Docker will handle restarting containers when they stop or fail. In this case, Docker will automatically restart the container if it is stopped for any reason unless you actively stop the container by calling the docker stop command.
- -p 80:80 -p 443:443: This is an option to map the server port to the container port. In this case, ports 80 and 443 on the server will be mapped to the corresponding ports on the container. This allows HTTP requests on port 80 and HTTPS requests on port 443 to be routed to the container.
- rancher/rancher:latest: Is the name and version of the image that the container will be run from. In this case, the image will be rancher/rancher, and the version used is latest, which is the latest version of this image.
The above command will run Rancher container and open port 80 and 443 to access Rancher UI . You can use docker ps command to check the running docker container (Including: container ID, image name, creation time, status, and port mapping from container to server).
Step 4: Access Rancher UI.
Once the Rancher container is running, you can access the Rancher UI by opening a web browser and entering the IP address or domain name along with port 80 or 443 (if you have HTTPS configured).
- http://Server_IP or http://your_domain_name.
And you will see the welcome page(Welcome to Rancher), when you access Rancher UI for the first time.
Step 5: Log in to Rancher.
As in step 4: Access Rancher UI , Rancher will ask you to enter Bootstrap Password , and to get the password, use the docker logs command with your container ID as suggested on the welcome page.
docker logs container-id 2>&1 | grep "Bootstrap Password:"
In addition, if you have already set a bootstrap password, enter your password in the Password box and click Log in with Local User to log in, without having to use the above command to get the password.
With 9b97a80382d8 being my container ID.
Next Rancher will ask you to set a password for the admin user with two options for you to choose and set the password according to your needs.
- Use a randomly generated password: Use the randomly generated password below.
- Set a specific password to use: Set a specific password to use.
Here I choose to create a random password and check the box By checking the box, you accept the End User License Agreement & Terms & Conditions and click Continue .
So you have completed the Rancher installation process and can use Rancher to deploy and manage your Kubernetes clusters with a convenient interface, and all operations are on the website interface.
Wishing you success!
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com.