Kubernetes 1.5 Installation

Source: Internet
Author: User
Tags etcd

Kubernetes introduced Kubeadm from 1.3 to try to simplify its complex installation. But Kubeadm is still not stable, and I personally think Kubeadm instead of trouble, rather than directly with the script or other automated tools to install the neat. There are also alternatives to HA for KUBEADM configuration master, such as using highly available cluster software such as keepalived or Corosync. So in this document, I will still use the traditional way to install the Kubernetes cluster

Kubernetes relies on the network of Docker and Etcd,docker, where the flannel is used directly. In this document, there is no too much elaboration of the high availability of master, and we will start by simply building a basic available minimized cluster. I use three CentOS 7.2 servers here, each server role is described as follows:

192.168.1.20 server-20 Master nodes, node nodes, ETCD nodes 192.168.1.21 server-21 node nodes, ETCD nodes 192.168.1.22 server-22 node nodes, etc D-Node

What needs to be explained is that we need to set up the basic environment, such as turning off SELinux, configuring time synchronization, emptying the existing iptables strategy, and configuring the Epel source.

1. Install and start Docker

Docker installation is simple and can be installed directly with Yum:

Yum install-y dockersystemctl start Dockersystemctl enable Docker

2, Installation Etcd

Perform the following installation actions on all nodes:

Yum-y Install etcd# Create ETCD Data directory mkdir-p/opt/etcd/datachown-r etcd:etcd/opt/etcd/# Modify the configuration file,/etc/etcd/etcd.conf need to modify the following Parameter: etcd_name=server-20etcd_data_dir= "/opt/etcd/data/server-20.etcd" etcd_listen_peer_urls= "ETCD_LISTEN_CLIENT_ urls= "etcd_initial_advertise_peer_urls=" etcd_initial_cluster= "server-20=etcd_advertise_client_urls="/HTTP/ 192.168.1.20:2379 "

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "style=" Float:left; "/>

# Modify ETCD Startup file Sed-i ' s/\\\ "${etcd_listen_client_urls}\\\"/\\\ "${etcd_listen_client_urls}\\\"--listen-client-urls=\ \ \ "${etcd_listen_client_urls}\\\"--advertise-client-urls=\\\ "${etcd_advertise_client_urls}\\\"-- initial-cluster-token=\\\ "${etcd_initial_cluster_token}\\\"--initial-cluster=\\\ "${ETCD_INITIAL_CLUSTER}\\\"-- initial-cluster-state=\\\ "${etcd_initial_cluster_state}\\\"/g '/usr/lib/systemd/system/etcd.service


650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

# start Etcdsystemctl enable Etcdsystemctl start Etcdsystemctl status etcd# view cluster status Etcdctl cluster-health

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>



650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

# start Etcdsystemctl enable Etcdsystemctl start Etcdsystemctl status etcd# view cluster status Etcdctl cluster-health

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>


3, Configuration Flannel

Register the flannel subnet in ETCD first:

Etcdctl set/coreos.com/network/config ' {"Network": "172.16.0.0/16"} '

Install flannel on all nodes:

Yum Install-y Flannel

Modify the flannel configuration file/etc/sysconfig/flanneld as follows:

Flannel_etcd= "http://192.168.1.20:2379,http://192.168.1.21:2379,http://192.168.1.22:2379" flannel_etcd_key= "/ Coreos.com/network "

Start Flannel:

Systemctl start Flanneldsystemctl Enable Flanneld

It is important to note that if you want Docker to use Flannel's network, Docker must start after flannel, so you need to restart Docker:

Systemctl Restart Docker

4, install Kubernetes service side

I'm using a private kubernetes yum source provided by someone online, as follows:

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

VIM/ETC/YUM.REPOS.D/KUBE.REPO[KUBE]NAME=MRITD repositorybaseurl=https://yum.mritd.me/centos/7/x86_64enabled= 1gpgcheck=1gpgkey=https://mritd.b0.upaiyun.com/keys/rpm.public.key

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

All kubernetes related packages are downloaded through Yumdownloader and then installed via the local yum:

Yumdownloader kubernetes-master kubernetes-client Kubernetes-nodeyum localinstall-y kubernetes-master Kubernetes-client

Modify the configuration file on Kubernetes master as follows:

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

Vim/etc/kubernetes/configkube_logtostderr= "--logtostderr=true" kube_log_level= "--v=0" KUBE_ALLOW_PRIV= "-- Allow-privileged=false "kube_master="--master=http://10.5.10.116:8080 "Vim/etc/kubernetes/apiserverkube_api_ address= "--address=0.0.0.0" kube_api_port= "--port=8080--secure-port=443" kube_master= "--master=http:// 10.5.10.116:8080 "kubelet_port="--kubelet-port=10250 "kube_etcd_servers="--etcd-servers=http://10.5.10.116:2379, http://10.5.10.117:2379,http://10.5.10.131:2379 "kube_service_addresses="--service-cluster-ip-range=10.254.0.0/ "Kube_admission_control="--admission-control=namespacelifecycle,namespaceexists,limitranger, Securitycontextdeny,resourcequota "

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

Start Kubernetes Master:

Systemctl start kube-apiserver kube-controller-manager kube-schedulersystemctl enable Kube-apiserver Kube-controller-manager Kube-scheduler

5, install kubernetes node side

Yum Install-y Kubernetes-node

To modify a node's configuration file:

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

Vim/etc/kubernetes/configkube_logtostderr= "--logtostderr=true" kube_log_level= "--v=0" KUBE_ALLOW_PRIV= "-- Allow-privileged=false "kube_master="--master=http://10.5.10.116:8080 "vim/etc/kubernetes/kubeletkubelet_address = "--address=0.0.0.0" kubelet_hostname= "--hostname-override=server-116" kubelet_api_server= "--api-servers=http:// 10.5.10.116:8080 "Kubelet_pod_infra_container="--pod-infra-container-image=myhub.fdccloud.com/library/ Pod-infrastructure:latest "

650) this.width=650; "src="/img/fz.gif "alt=" Copy Code "/>

Start the node side:

Systemctl start Kubelet kube-proxysystemctl enable Kubelet Kube-proxy

Finally, see if the nodes are normal by kubectl on Kubernetes master:

[[email protected] ~]# kubectl get nodesname STATUS AGEserver-20 ready 1dserver-21 Ready 1dserver-2 2 Ready 1d

At this point, complete the basic installation of Kubernetes 1.5


This article is from the "My Sky" blog, so be sure to keep this source http://sky66.blog.51cto.com/2439074/1933995

Kubernetes 1.5 Installation

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.