KUBERNETES cluster to build the basic environment
System Environment # Cat/etc/redhat-releasecentos Linux release 7.3.1611 (Core)
Host name Settings Centos-master 192.168.59.135centos-minion1 192.168.59.132centos-minion2 192.168.59.133
Restart server after SELinux and Firewalld are turned off
# systemctl Stop firewalld# systemctl disable firewalld# setenforce 0# sed-i ' s/^selinux=.*/selinux=disableds/'/etc/seli Nux/config
Master Node Installation Deployment
#yum Install ETCD kubernetes-y version # Rpm-qa | grep etcdetcd-3.2.7-1.el7.x86_64# Rpm-qa | grep kuberneteskubernetes-client-1.5.2-0.7.git269f928.el7.x86_64kubernetes-1.5.2-0.7.git269f928.el7.x86_ 64kubernetes-master-1.5.2-0.7.git269f928.el7.x86_64kubernetes-node-1.5.2-0.7.git269f928.el7.x86_64
Configure etcd/etc/etcd/etcd.conf
# Cat/etc/etcd/etcd.conf | Grep-ev "^#|^$" etcd_name=centos-masteretcd_data_dir= "/VAR/LIB/ETCD/DEFAULT.ETCD" ETCD_LISTEN_PEER_URLS= "http// 0.0.0.0:2380 "etcd_listen_client_urls=" http://0.0.0.0:2379 "etcd_initial_advertise_peer_urls="/HTTP/ 192.168.59.135:2380 "Etcd_initial_cluster=" centos-master=http://192.168.59.135:2380,centos-minion2=http:// 192.168.59.133:2380,centos-minion1=http://192.168.59.132:2380 "etcd_initial_cluster_state=" new "ETCD_INITIAL_ Cluster_token= "Etcd-cluster" etcd_advertise_client_urls= "http://192.168.59.135:2379"
Configuring Kubernetes API Server (/etc/kubernetes/apiserver)
# Cat/etc/kubernetes/apiserver | Grep-ev "^#|^$" 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 "Kube_api_args=" "
Configuring Kubernetes config (/etc/kubernetes/config)
# Cat/etc/kubernetes/config | Grep-ev "^#|^$" kube_logtostderr= "--logtostderr=true" kube_log_level= "--v=0" kube_allow_priv= "--allow-privileged= False "kube_master="--master=http://centos-master:8080 "
Minion node installation (Minion1 and Minion2)
# yum Install flannel ETCD Docker kubernetes-y
Configuration Etcd (/etc/etcd/etcd.conf)
# grep -ev "^#|^$" /etc/etcd/etcd.conf etcd_name=centos-minion2etcd_data_dir= "/var/ Lib/etcd/default.etcd "etcd_listen_peer_urls=" http://0.0.0.0:2380 "etcd_listen_client_urls=" http://0.0.0.0:2379 " etcd_initial_advertise_peer_urls= "http://192.168.59.133:2380" etcd_initial_cluster= "centos-master=http:// 192.168.59.135:2380,centos-minion2=http://192.168.59.133:2380,centos-minion1=http://192.168.59.132:2380 "ETCD_ Initial_cluster_state= "new" etcd_initial_cluster_token= "Etcd-cluster" etcd_advertise_client_urls= "http// 192.168.59.133:2379 "# grep -ev " ^#|^$ " /etc/etcd/etcd.conf etcd_name= Centos-minion1etcd_data_dir= "/var/lib/etcd/default.etcd" etcd_listen_peer_urls= "http://0.0.0.0:2380" ETCD_LISTEN _client_urls= "http://0.0.0.0:2379" etcd_initial_advertise_peer_urls= "http://192.168.59.132:2380" Etcd_initial_ Cluster= "centos-master=http://192.168.59.135:2380,centos-minion2=http://192.168.59.133:2380,centos-minion1= http://192.168.59.132:2380 "Etcd_initial_cluster_state= "new" etcd_initial_cluster_token= "Etcd-cluster" etcd_advertise_client_urls= "http://192.168.59.132:2379"
Configuration flannel (/etc/sysconfig/flanneld)
# Grep-ev "^#|^$"/etc/sysconfig/flanneldflannel_etcd_endpoints= "http://192.168.59.133:2379" flannel_etcd_prefix= " /atomic.io/network "
Configuration Kubelet (/etc/kubernetes/kubelet)
# Grep-ev "^#|^$"/etc/kubernetes/kubelet kubelet_address= "--address=0.0.0.0" kubelet_port= "--port=10250" KUBELET_ Hostname= "--hostname-override=centos-minion2" kubelet_api_server= "--api-servers=http://centos-master:8080" # Please fill in your registry address below, if you can connect to any network, please automatically filter kubelet_pod_infra_container= "--pod-infra-container-image= Registry.access.redhat.com/rhel7/pod-infrastructure:latest "# Fill in your DNS information, such as # kubelet_args="--cluster-dns= 192.168.51.198--cluster-domain=atomic.io/network "kubelet_args=" "
Startup program on Master
For SERVICES in Etcd kube-apiserver Kube-controller-manager Kube-scheduler; Do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES-ldone
ETCD Network Configuration # etcdctl Mk/atomic.io/network/config ' {"Network": "172.17.0.0/16"} '
Startup program on Minion
For SERVICES in Etcd Kube-proxy kubelet Docker Flanneld; Do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICES done
View ETCD cluster situation (any one can)
# ETCDCTL member List10a23ff41e3abcb8:name=centos-minion1 peerurls=http://192.168.59.132:2380 clientURLs=http:// 192.168.59.132:2379 Isleader=false168ea6ce7632b2e4:name=centos-minion2 peerurls=http://192.168.59.133:2380 clienturls=http://192.168.59.133:2379 Isleader=true587d83f824bf96c6:name=centos-master peerURLs=http:// 192.168.59.135:2380 clienturls=http://192.168.59.135:2379 isleader=false# Etcdctl cluster-healthmember 10A23FF41E3ABCB8 is Healthy:got healthy result from Http://192.168.59.132:2379member 168ea6ce7632b2e4 is Healthy:got hea Lthy result from Http://192.168.59.133:2379member 587d83f824bf96c6 was healthy:got healthy result from http://192.168.59. 135:2379cluster is healthy
View node status (in Master)
# Kubectl Get nodesname STATUS agecentos-minion1 ready 1hcentos-minion2 Ready 1h
View Flannel NIC
[[Email protected] ~]# ifconfig flannel0flannel0: flags=4305<up,pointopoint, running,noarp,multicast> mtu 1472 inet 172.17.34.0 netmask 255.255.0.0 destination 172.17.34.0 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) rx packets 0 bytes 0 (0.0 b) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 b) TX errors 0 dropped 0 overruns 0 Carrier 0 collisions 0[[Email protected] ~]# ifconfig flannel0flannel0: flags=4305<up,pointopoint, running,noarp,multicast> mtu 1472 inet 172.17.59.0 netmask 255.255.0.0 destination 172.17.59.0 inet6 fe80::2d54:2169:1a0:d364 prefixlen 64 scopeid 0x20<link> unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC) RX packets 0 bytes 0 (0.0 b) rx errors 0 dropped 0 overruns 0 frame 0 TX packets 3 bytes 144 (144.0 b) &NBSP;&NBSP;&Nbsp; tx errors 0 dropped 0 overruns 0 carrier 0 collisions 0
This article is from the "Bamboo" blog, make sure to keep this source http://wuyebamboo.blog.51cto.com/3344855/1977496
KUBERNETES-1.52 Cluster Construction