Build enterprise mirror private server Harbor

Empty your cup so that it can be filled again. —— Bruce Lee

This paper introduces

  • P2 Build a production-level Linux system
  • P3 Learn Docker in half an hour
  • P4 Write Dockerfile and upload DockerHub
  • P5 Docker SpringCloud – compose deployment
  • P6 Build Harbor private server for enterprise mirror
  • P7 K8S & Rancher is coming! Theory & Preparation
  • P8 Rancher2.3 built K8S 1.16 cluster
  • P9 Deploy Spring Cloud to Kubernetes
  • P10 Deploy Vue to Kubernetes config ingress
  • P11 Ha01-rke install Kubernetes cluster
  • P12 HA02-Helm deploys the Rancher cluster

Theory of article

Dcoker

The role of Docker is easy to understand. It is a container engine, which means that our container is ultimately created by Docker and runs in Docker. Other container technologies are based on Docker, which is the core of other container technologies we use.

Docker-Compose

Docker-compose is composed for managing your containers. It’s kind of like a container keeper. Imagine if your Docker has hundreds of containers that need to be started. With docker-compose, you just write a file, declare the container you want to start, set some parameters, execute the file, and Docker will start all the containers according to the configuration you declared. Docker-compose can only manage the Docker on the current host, that is, cannot start Docker containers on other hosts.

Docker Swarm

Docker Swarm is a tool used to manage Docker containers on multiple hosts. It can help you start the container and monitor the status of the container. If the status of the container is abnormal, it will help you restart a new container to provide services, and also provide load balancing between services. Docker-compose can’t do that.

Kubernetes

The role positioning of Kubernetes itself is the same as that of Docker Swarm, that is to say, they are responsible for the same part of the container field, of course, there are some different characteristics. This, like Eclipse and IDEA, is a cross-host container management platform. It is a container management platform developed by Google based on its own years of operation and maintenance experience. Docker Swarm was developed by Docker.

Rancher & Kubernete

Rancher Rancher is more like a PAAS management platform of microcontainer cloud. It supports the selection of container layout framework (V1). It can be seen as a management platform of K8s. Manage multiple K8S clusters, check the running status of K8S cluster nodes and so on.

Resources division

IP configuration role
172.17.0.150 2C/4G/40G Install the rancher – server (etcd/control)
172.17.0.151 1C/4G/40G Install the rancher – agent (worker)
172.17.0.152 1C/4G/40G Install the rancher – agent (worker)
172.17.0.153 1C/4G/40G Install the rancher – agent (worker)
172.17.0.154 1C/2G/40G Install the HarborNFS file server

The topology

Prepare the machine

  1. Initialize centos7
  2. Install the docker
  3. Install the docker – compose
  4. Install the harbor
  5. Configuration server
  6. Prepare the NFS

Install the Docker

# Install Docker official source
sudo yum-config-manager \
     --add-repo \
     https://download.docker.com/linux/centos/docker-ce.repo
     
# update source
yum makecache fast
 
# installation
yum install docker-ce
 
Start and set the boot to self-boot
systemctl start docker && systemctl enable docker
Copy the code

Install Compose

mv docker-compose-Linux-x86_64 docker-compose
 
chmod +x /usr/local/bin/docker-compose
Copy the code

Install the Harbor

# PrerequisitesInstalled docker - compose# Unpack harbor offline packageTar - ZXVF harbor - offline installer - v1.9.3. TGZ# Modify the harbor.yml hostname configuration
vim harbor.yml
 
# install
sh install.sh
Copy the code

Docker configuration private server

Modify docker access private server

vim /etc/docker/daemon.json

"insecure-registries" : ["172.17.0.154"]

# restart docker
 
systemctl restart docker
Copy the code

Set up the NFS

yum install -y nfs-common nfs-utils  rpcbind 
 
# assign permissions
mkdir /nfsdata  && chmod 666 /nfsdata && chown nfsnobody /nfsdata  
 
Configure mount
vim /etc/exports
 
/nfsdata *(rw,no_root_squash,no_all_squash,sync)
 
# start
systemctl start rpcbind && systemctl start nfs

Copy the code

To be perfect…

Form a complete set of data

Please pay attention to wechat (Java-note), message: K8S for supporting information

2.3 Building a K8S 1.16 cluster