Kubernetes components and role distribution component functions:
-Etcd a highly available k/v key value to the storage and service discovery system
-Flannel The communication of the container network of the boast host
-Kube-apiserver provides API calls to Kubernetes clusters
-Kube-controller-manager ensure Cluster service
-Kube-scheduler dispatch container, assign to Node
-Kubelet boot container on node node according to the container specification defined in the configuration file
-Kube-proxy provides network proxy service
Role Distribution:
Host |
role |
192.168.10.131 |
ETCD Server, Kubernetes Master |
192.168.10.128 |
Kubernetes node |
192.168.10.135 |
Kubernetes node |
Configuring the Epel-release Source
# yum -y install epel-release
Second, master node configuration
1. Install ETCD and kubernetes-master on master
[[email protected] ~]# yum -y install etcd kubernetes-master
2. Modify the ETCD configuration file
[[email protected] ~]# cat /etc/etcd/etcd.conf | grep -v "^#"ETCD_DATA_DIR="/var/lib/etcd/default.etcd"ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"ETCD_NAME="default"ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
3. Modify the Kubernetes configuration file
[[email protected] ~]# cat /etc/kubernetes/apiserver | grep -v "^#" | grep -v "^$"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,ServiceAccount,ResourceQuota"KUBE_API_ARGS=""
4. Set up service startup
[[email protected] ~]# for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES ; done
5. Define the flannel network in ETCD
[[email protected]t ~]# etcdctl mk /atomic.io/network/config ‘{"Network":"172.17.0.0/16"}‘{"Network":"172.17.0.0/16"}
Third, node configuration
1: Install flannel and Kubernetes-node on all node nodes
[[email protected] ~]# yum -y install flannel kubernetes-node
2. Modify the Flannel configuration file
[[email protected] ~]# cat /etc/sysconfig/flanneld | grep -v "^#" | grep -v "^$"FLANNEL_ETCD_ENDPOINTS="http://192.168.10.131:2379"FLANNEL_ETCD_PREFIX="/atomic.io/network"
3. Modify the Kubernetes configuration file
[[email protected] ~]# cat /etc/kubernetes/config | grep -v "^#" | grep -v "^$"KUBE_LOGTOSTDERR="--logtostderr=true"KUBE_LOG_LEVEL="--v=0"KUBE_ALLOW_PRIV="--allow-privileged=false"KUBE_MASTER="--master=http://192.168.10.131:8080"
[[email protected] ~]# cat /etc/kubernetes/kubelet| grep -v "^#" | grep -v "^$"KUBELET_ADDRESS="--address=0.0.0.0"KUBELET_PORT="--port=10250"KUBELET_HOSTNAME="--hostname-override=192.168.10.128"KUBELET_API_SERVER="--api-servers=http://192.168.10.131:8080" #修改成对应Node的IPKUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"KUBELET_ARGS=""
4. Start Kube-proxy,kubelet,docker,flanneld and other services
[[email protected] ~]# for SERVICES in kube-proxy kubelet docker flanneld;do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES; done
Iv. Viewing cluster boot status
[[email protected] ~]# kubectl get nodeNAME STATUS AGE192.168.10.128 Ready 1m192.168.10.135 Ready 1m
Kubernetes Cluster deployment