Rancher installation, deployment, use

1. Build the rancher platform

(1) Enter the operating system interface through the training platform, enter the vi /etc/sysconfig/ docker command after #, and edit the configuration file. The sample code is as follows:

[[email protected] home]# vi /etc/sysconfig/docker

Press the i (lowercase) key to enter the edit mode, add two lines of code ADD_REGISTRY='--add-registry 10.24.2.54:5000' (the IP address is filled in according to the actual situation) and INSECURE_REGISTRY='--insecure-registry 10.24.2.54:5000' (Fill in the IP address according to the actual situation), after the addition is complete, press the Esc key, enter the :wq command, save and exit. The sample code is shown in Figure 1:

insert image description here
(2) Enter the systemctl restart docker command after # to restart the docker service. The sample code is as follows:

[[email protected] home]# systemctl restart docker

(3) Enter the docker load < /home/registry_latest.tar command after #. Import the Registry image, the sample code is shown in Figure 2:

insert image description here

(4) Enter the docker run -d -p 5000:5000 --restart=always --name registry docker.io/registry:latest command after #, run the image repository, and enter docker ps -l after # to view the running container . The sample code is shown in Figure 3:
insert image description here

(5) Enter the docker images command after # to view the current image list. After the # docker tag c9bd19d022f6 10.24.2.54:5000/registry:latest command (ID is the image ID, and the IP address is filled in according to the actual situation), the sample code is shown in Figure 4:

insert image description here

(6) Enter the docker push 10.24.2.54:5000/registry:latest command after # to upload the image to the private repository. The sample code is shown in Figure 5:

insert image description here
(7) Enter the docker load < /home/rancher_server_v1.6.5.tar command after # to import the image. The sample code is shown in Figure 6:
insert image description here

(8) Enter the docker tag f89070da7581 10.24.2.54:5000/rancher/server:v1.6.5 command after # (the IP address is filled in according to the actual situation), add a label to the image, and then enter docker push 10.24.2.54:5000 after # /rancher/server:v1.6.5 command, upload the image to the warehouse, the sample code is shown in Figure 7:
insert image description here
(9) Enter docker run -d --restart=always -p 8080:8080 rancher/server:v1 after #. 6.5 command, run the rancher image, the sample code is shown in Figure 8:
insert image description here

2. Manage rancher platform

(1) Select the "Virtual Machine Information" option in the training platform to switch to another virtual machine. Open the browser in the virtual machine, enter http://10.24.2.54:8080 (the IP address is the warehouse node address) address to access the rancher platform, then click the language option at the bottom of the page, and select the "Simplified Chinese" language, as shown in Figure 9. Show:
insert image description here

(2) Click "Infrastructure" in the navigation bar, select the "Host" button, and on the page, click the Add host button. An example is shown in Figure 10:
insert image description here

(3) On the jump page, click the save button directly to set the host registration address. The example is shown in Figure 11:
insert image description here
(4) In the jump page, specify the address of the rancher/server node in the fourth step, manually select the code in the copy box, click the hidden toolbar button on the training page, and select "Clipboard" button" to select and copy all the codes that appear in the clipboard, as shown in Figure 12 for example:
insert image description here
(5) Click the "Virtual Machine Information" option on the training page to return to the first node, and paste the copied code after # Script content, and press Enter to execute, the sample code is shown in Figure 13:
insert image description here

(6) After the registration is completed, click the "Virtual Machine Information" option on the training page, go back to the second node, and on the rancher platform page, click "Infrastructure" in the navigation bar, and click the host option to view the added host. . Click "Infrastructure" in the navigation bar, click the container option, and wait for the status of all services to be "Running", that is, the host is added successfully. An example is shown in Figure 14:
insert image description here

3. Deployment case

(1) In the navigation bar of the rancher platform, click the app store button, find the wordpress application, and click to view the details. The example is shown in Figure 15:
insert image description here

(2) Change the port number of the WordPress application to 8083, and then click the start button at the bottom of the page, as shown in Figure 16:
insert image description here

(3) After waiting for a period of time, Active appears and the creation is successful. The creation is successful as shown in Figure 17. After the creation is successful, click port 8083/tcp to directly access the WordPress application, as shown in Figure 18:
insert image description here
Access WordPress
insert image description here

Related: Rancher installation, deployment, use