Install the entry-level kubernetes cluster under CENTOS7

Source: Internet
Author: User
Tags etcd

Previously description: Three CENTOS7 system virtual machines (1 master+2 node), three machines on the firewall, SELinux all turned off. My experimental bad environment can be online, the default Yum source can be used.

1. What is Kubernetes

Kubernetes (k8s) is Google open-source container cluster Management system (Google internal: Borg). On the basis of Docker technology, a series of complete functions such as deployment operation, resource scheduling, service discovery and dynamic scaling are provided for containerized applications, which improves the convenience of large-scale container cluster management.

Kubernetes Advantages:

-Container Orchestration

-Lightweight

-Open Source

-Elastic expansion

-Load Balancing

? The core concept of kubernetes

1) Pod

A combination of several related containers that run on node nodes. The containers contained within the Pod run on the same host, using the same network namespace, IP address, and port to pass through localhost. Pods are the smallest unit of kurbernetes for Creation, dispatch, and management, providing a higher level of abstraction than containers, making deployment and management more flexible.                        A pod can contain a container or multiple related containers. 2) Replication Controller
The Replication Controller manages a copy of the pod to ensure that a specified number of pod copies exist in the cluster. If the number of replicas in the cluster is greater than the specified number, the number of extra containers that are outside the specified number is stopped, and conversely, containers with fewer than a specified number are started and the quantity is guaranteed to be constant. Replication Controller is the core of elastic scaling, dynamic expansion and rolling upgrades.

3) Service

The service defines the logical set of pods and the policies that access the collection, which is an abstraction of the real service. The service provides a unified access portal for services and service proxies and discovery mechanisms that users do not need to know how the background pod is running.

4) Label

Any API object in Kubernetes is identified by a label, and the essence of the label is a series of k/v key-value pairs. The label is the basis for running the replication controller and service, and they are associated with the pod running on node with a label.

5) Node

node is the service node (or agent) that runs the pod in the Kubernetes cluster schema. node is a unit of Kubernetes cluster operation that hosts the running of the allocated pod and is the host on which the pod runs.

2. Install Kubernetes Master First

1) Install ETCD and kubernetes-master using Yum

# yum-y Install ETCD Kubernetes-master Flannel

2) Edit the/etc/etcd/etcd.conf file

Etcd_name=defaultetcd_data_dir="/var/lib/etcd/default.etcd"etcd_listen_client_urls= "http://0.0.0.0:2379"etcd_advertise_client_urls="http://localhost:2379 " 

3) Edit the/etc/kubernetes/apiserver file

kube_api_address="--insecure-bind-address=0.0.0.0"kube_api_port="--port=8080 "kubelet_port=" --kubelet-port=10250 "kube_etcd _servers= "--etcd-servers=http://127.0.0.1:2379 "kube_service_addresses=" --service-cluster-ip-range=10.254.0.0/16 "kube_admission_control=" --admission-control =namespacelifecycle,namespaceexists,limitranger,securitycontextdeny,resourcequota "
//Note: The Servercount in the previous sentence must be removed, otherwise the pod will have no data.

4) Define flannel network in ETCD

'{' Network ': ' 172.17.0.0/16 '}' 

5) Edit/etc/sysconfig/flanneld

Flannel_etcd_endpoints= "http://0.0.0.0:2379"
flannel_etcd_prefix= "/atomic.io/network"

6) Start Etcd, Kube-apiserver, Kube-controller-manager, Kube-scheduler, Flanneld and other services, and set up boot.

In Etcd kube-apiserver kube-controller-manager Kube-scheduler Flanneld;
Do
Systemctl restart $SERVICES;
Systemctl enable $SERVICES;
Systemctl status $SERVICES;
Done

3. Installation configuration kubernetes Node

1) Install flannel and kubernetes-node using Yum

Install flannel Kubernetes-node

2) Specify ETCD service for flannel Network, modify/etc/sysconfig/flanneld file

flannel_etcd="http://192.168.118.139:2379" flannel_etcd_key= "/atomic.io/network "

3) Modify the/etc/kubernetes/config file

kube_logtostderr="--logtostderr=true"kube_log_level="--v=0"kube_allow_priv= "--allow-privileged=false"kube_master="--master=http://192.168.30.20:8080" 

4) Modify the configuration file corresponding to node according to the following contents/etc/kubernetes/kubelet

Node1:

kubelet_address="--address=0.0.0.0"kubelet_port= "--port= 10250 "kubelet_hostname= "--hostname-override=192.168.118.140"  #修改成对应Node的IP kubelet_api_server=" Span style= "COLOR: #800000" >--api-servers=http://192.168.118.139:8080 "# Specifies the master node's API Serverkubelet_pod_infra_container= " Span style= "COLOR: #800000" >--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure: Latest "kubelet_args="  

Node2:

kubelet_address="--address=0.0.0.0"kubelet_port="--port=10250"kubelet_hostname="--hostname-override= 192.168.118.141" kubelet_api_server="--api-servers=http://192.168.118.139:8080 " kubelet_pod_infra_container="--pod-infra-container-image=registry.access.redhat.com/rhel7/ Pod-infrastructure:latest"kubelet_args=""         

5) Start the Kube-proxy,kubelet,docker,flanneld and other services on all node nodes and set the boot up.

In Kube-proxy Kubelet Docker Flanneld;   Done
4. Verify that it is successful
< Span style= "COLOR: #800080" > < Span style= "COLOR: #800080" >[[email protected] ~]# kubectl get node
name               status    age
192.168.118.140   Ready      3d
192.168.118.141   ready     3d


Summary: Most of the above documents are from http://www.cnblogs.com/xkops/p/6169034.html, and thank Han for their answers! Keep a record of your learning process.





Install the entry-level kubernetes cluster under CENTOS7

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.