Kubernetes study notes (a): the deployment of a local cluster kubernetes

Foreword

Minikube had earlier used only a single node of the cluster k8s, which is not enough for learning purposes. We need to have a multi-node cluster to use a variety of scheduling / monitoring functions. And only a single node quoted a "cluster."

kubernetes installation Aspects

kubernetes is a component-based system, the installation process is very flexible, many components have a variety of implementations that have their own characteristics, so that beginners confused.

And should one of these components can be installed and configured to work together is not easy.

So there have been a variety of community programs installed. Installation program so much that I do not know what the use is good. . So I had a lot of investigation. The installation of several popular programs are listed below:

  1. minikube / microk8s: single-node cluster, only suitable for learning / development use.
  2. kubeadm : k8s official launch of a k8s quick installation tools, but there is still a certain amount of work.
  3. kubespray : k8s community projects, using ansible deployment k8s can be used for the production environment. (K8s-sigs, i.e. k8s special interest group)
  4. Rancher : over k8s enterprise management system, installation is very convenient, Chinese documents in considerable detail, but it also provides a higher level of management.
  5. kubesphere : and rancher similar, but also build a cloud platform management system on top of k8s. Interface is very beautiful.

In addition there are community n kinds of programs to choose from, varied. And attention (stars) is not low. Bite off more than you can chew, I will not describe.

Some searching, I eventually identified with the rancher to deploy my first kubernetes multi-node cluster, how simple and how to ha ha ~

First, prepare your virtual machine

To deploy a multi-node Well, naturally you have to have multiple hosts. I own enough memory machine, directly open an Ubuntu virtual machine, and then cloned four. (This clone operation results behind me fell into a pit ..)

Host's operating system may use a simplified version of the official rancher RancherOS, you can also use their own familiar Ubuntu Debian and so on. Here the main emphasis on a pit:

  1. Hostname hosts can not be the same! ! ! Otherwise subsequent node deployment is not always on! (Sorrowful lesson ..)

Specific host configuration process official documents written in great detail, the venue and basic environment configuration Rancher-

Second, the deployment rancher

1. Deploy rancher server

First official run on used rancher server virtual machine docker given command to start the rancher server:

sudo docker run -d -v <主机路径>:/var/lib/rancher/ --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:stable

But to be honest I think it docker-compose the way will be even better.

Once deployed access https://<server-ip>configured username / password / url, this nothing to say.

2. Deploy a cluster kubernetes

Now enter the rancher home page, click on the upper right corner, "adding clusters", select "Custom" to add a local cluster.

Of course, if you are using a cloud service that directly use the corresponding function rancher offered clearly more convenient. (Navigation bar "Tools" - "drive Management" can add "Ali cloud", "Tencent cloud", "cloud Huawei" cloud services such as domestic support)

Then enter "cluster name", "cloud provider" select "None."

The final step is to then - rancher agent-- deployed on each node of.

As long as you check the workeroption (in fact, add a --workerparameter), rancher agent at run time, it will automatically be deployed on the nodes k8sof all container nodes need.

Belt running on a plurality of nodes --workerrancher agnet command, to obtain a plurality k8s worker. The etcd and controller development environment for each deployment of a fine.

Then you can happily play the hhh ~

Guess you like

Origin www.cnblogs.com/kirito-c/p/11588117.html