CENTOS7 Yum Installation Kubernetes 1.1

Source: Internet
Author: User
Tags etcd

Prerequisite: CENTOS7 has been update

Yum Update-y


First, to create a Yum source Master,slave are

Kubernetes Release version Yum source

http://cbs.centos.org/repos/virt7-docker-common-release/x86_64/os/Packages/


VI Virt7-docker-common-release.repo

[virt7-docker-common-release]name=virt7-docker-common-releasebaseurl=http://cbs.centos.org/repos/ Virt7-docker-common-release/x86_64/os/gpgcheck=0


Second, Yum installation Services

Yum-y Install--enablerepo=virt7-docker-common-release kubernetes ETCD


Third, add the hostname to Master,slave/etc/hosts, if the hostname has DNS resolution, you do not need to add

echo "192.168.5.221 k8s_master192.168.5.222 k8s_slave1192.168.5.237 k8s_slave2" >>/etc/hosts


Iv. Modification of/etc/kubernetes/config (all nodes)

# Logging to stderr means we get it in the Systemd journalkube_logtostderr= '--logtostderr=true ' # Journal message level, 0 is debugkube_log_level= "--v=0" # should this cluster being allowed to run privileged Docker containerskube_allow_priv= "--allo W-privileged=false "# How the Controller-manager, scheduler, and proxy find the apiserverkube_master="--master=http:// 192.168.5.221:8080 "


Five, disable the firewall

Systemctl Disable iptables-services firewalldsystemctl stop iptables-services FIREWALLD


Vi. Configuring the Kubernetes service on the master node

Modify the configuration file/etc/etcd/etcd.conf, make sure ETCD listens to all addresses, modify the following:

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


Modify the configuration file/etc/kubernetes/apiserver, as follows:

# # # Kubernetes System config## The following values is used to configure the kube-apiserver## the address on the local s Erver to listen. Kube_api_address= "--address=0.0.0.0" # The port on the local server to listen on. Kube_api_port= "--port=8080" # PORT Minions Listen onkubelet_port= "--kubelet-port=10250" # Comma separated list of nodes in The Etcd clusterkube_etcd_servers= "--etcd-servers=http://127.0.0.1:2379" # Address range to use for Serviceskube_ Service_addresses= "--SERVICE-CLUSTER-IP-RANGE=10.254.0.0/16" # Default Admission Control Policieskube_admission_ Control= "--admission-control=namespacelifecycle,namespaceexists,limitranger,resourcequota" # Add your own! Kube_api_args= ""


Modify configuration file/etc/kubernetes/controller-manager, define minions IP address

Kubelet_addresses= "--machines=192.168.5.222,192.168.5.223"


Start the service

For SERVICES in Etcd kube-apiserver Kube-controller-manager Kube-scheduler; Do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES done


Note: Certificate authentication will be automatically added to 1.1, the program will automatically generate the certificate file, you need to check the directory of the main genus Group

[[Email protected]_master kubernetes]# pwd/var/run/kubernetes[[email protected]_master kubernetes]# ll-rw-r--r--1 Kube kube 15:16 apiserver.crt-rw-------1 kube kube 1679 Nov 15:16 Apiserver.key


Restart Service

For SERVICES in Etcd kube-apiserver Kube-controller-manager Kube-scheduler; Do systemctl restart $SERVICES systemctl status $SERVICES done



Minions node configuration

#单独安装docker 1.7

Yum install Docker-1.7.1* docker-selinux-1.7.1systemctl enable docker-storage-setup.servicesystemctl enable Docker.service


#yum Installing Kubernetes Flannel

Yum-y Install--enablerepo=virt7-docker-common-release kubernetes Flannel


#创建docker-pool

Docker-storage-setup


#为etcd服务配置flannel, modify the configuration file/etc/sysconfig/flanneld

Flannel_etcd= "http://192.168.5.221:2379"


#修改kubernetes配置文件, specify Master. /etc/kubernetes/config

# How the Controller-manager, scheduler, and proxy find the apiserverkube_master= "--master=http://192.168.5.221:8080"


#配置kubelet服务. /etc/kubernetes/kubelet

# The address for the ' Info server to serve ' on ' (set to 0.0.0.0 or ' "for all Interfaces) kubelet_address="--address=0.0.0.0 " # The port for the info server to serve onkubelet_port= "--port=10250" # Your may leave this blank to use the actual hostname Kubelet_hostname= "--hostname-override=192.168.5.237" # Location of the api-serverkubelet_api_server= "--api-servers= http://192.168.5.221:8080 "


#启动服务

For SERVICES in Kube-proxy Kubelet Docker Flanneld; Do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES done


If the error bridge IP (...) does not match existing bridge configuration, it is because Docker's bridge starts before the flannel causes a conflict

Remove Docker 0

IP link Set dev Docker0 downbrctl delbr Docker0


Vi/usr/lib/systemd/system/docker.service modified as follows:

[Unit] Description=docker Application Container enginedocumentation=http://docs.docker.comafter=flanneld.servicewants= Docker-storage-setup.servicerequires=flanneld.servicesystemctl Restart Docker


#验证

#在每个minions可以看到2块网卡: Docker0 and Flannel0, the IP address of these 2 NICs is different on different machine IP addresses. But the same as the machine's 2 NIC IP

IP A | Grep-e "Flannel|docker" |grep inet inet 172.17.58.0/16 scope Global flannel0 inet 172.17.58.1/24 scope Global Docker 0


#现在登陆master, confirm the status of the Minions

[[Email Protected]_master etcd]# kubectl get nodesname LABELS STATUS AGE192 .168.5.222 kubernetes.io/hostname=192.168.5.222 Ready 1d192.168.5.237 kubernetes.io/hostname=192.168.5.237 Rea DY 2d


This article is from the "Silver Fox" blog, please be sure to keep this source http://foxhound.blog.51cto.com/1167932/1717105

CENTOS7 Yum Installation Kubernetes 1.1

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.