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 Hostname

Master 192.168.0.87 K8s-cns1-mst

Node 192.168.0.88 K8s-cns1-nod1

Node 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-mst

192.168.0.88 k8s-cns1-nod1

192.168.0.89 K8S-CNS1-NOD2

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

Systemctl Stop Firewalld

Systemctl Disable FIREWALLD

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

Yum-y Install NTP

Systemctl Start NTPD

Systemctl Enable NTPD

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

[Root@k8s-cns1-nod2 home]# Cat installdocker.sh

#!/bin/bash

Yum install-y yum-utils Device-mapper-persistent-data lvm2

Yum-config-manager--add-repo Https://download.docker.com/linux/centos/docker-ce.repo

Yum-config-manager--enable Docker-ce-edge

Yum-config-manager--enable docker-ce-testing

Yum Makecache Fast

Yum 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 git

Go get-d k8s.io/kubernetes

Cd/root/go/src/k8s.io/kubernetes

git checkout release-1.6.3//using release-1.6.3 version

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 Installation Etcd

Yum-y Install ETCD

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

Etcd_name=default

Etcd_data_dir= "/var/lib/etcd/default.etcd"

Etcd_listen_client_urls= "http://0.0.0.0:2379"

3.1.3 Running ETCD

Systemctl Enable ETCD

Systemctl 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.