Centos7.2 Build kubernates Cluster

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

First, prepare the environment

1.1 Preparing the Machine

Prepare three CentOS7.2 machines, one as the master node and the other as node nodes

Modify Host Name

hostnamectl set-hostname k8s-mst
Role           IP                           HostnameMaster       192.168.0.87          k8s-cns1-mstNode          192.168.0.88         k8s-cns1-nod1Node          192.168.0.89         k8s-cns1-nod2

Modify the master node/etc/hosts, add the following (if not set, KUBECTL related commands on master cannot manipulate objects on the corresponding host)

192.168.0.87     k8s-cns1-mst192.168.0.88     k8s-cns1-nod1192.168.0.89     k8s-cns1-nod2

To avoid collisions with Docker iptables, close the firewall on the node nodes

systemctl stop firewalldsystemctl disable firewalld

To keep the time of each node consistent, all nodes install NTP

yum -y install ntpsystemctl start ntpdsystemctl enable ntpd

1.2 Installing Docker (the DOCKER-CE version is installed here)

[root@k8s-cns1-nod2 home]# cat installdocker.sh#!/bin/bashyum install -y yum-utils device-mapper-persistent-data lvm2yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoyum-config-manager --enable docker-ce-edgeyum-config-manager --enable docker-ce-testingyum makecache fastyum install -y docker-ce

Running Docker Daemon

systemctl start docker

Second, source code compilation

2.1 Preparing the Golang environment

Refer to Https://golang.org/doc/install, download the corresponding version and unzip to/usr/local, for example

tar -C /usr/local -xzf go1.8.3.linux-amd64.tar.gz

Install git, download the kubenates source and switch to the branch you need (this article uses)

yum install gitgo get -d k8s.io/kubernetescd /root/go/src/k8s.io/kubernetesgit checkout release-1.6.3      //使用release-1.6.3版本make

After the compilation succeeds, the executable file

/root/go/src/k8s.io/kubernetes/_output/bin

Third, configure the master

3.1 Install ECTD (optional, if already ETCD cluster skipped)

3.1.1 Software Installation

yum -y install etcd

3.1.2 Modifying the ETCD configuration/etc/etcd/etcd.conf

ETCD_NAME=defaultETCD_DATA_DIR="/var/lib/etcd/default.etcd"ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"

3.1.3 Running ETCD

systemctl enable etcdsystemctl start etcd

3.1.4 Configuring ETCD Subnets

etcdctl mk /atomic.io/network/config '{"Network":"172.17.0.0/16"}'

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.