Yum-y Install ETCD Docker flannel kubenetes
General will encounter no k8s source problem, first Yum update-y see if it is effective, if still useless to create a Yum source, and then install Kubenetes
Do the following:
Create a Yum source
vi virt7-docker-common-release.repo
Add the following content:
[virt7-docker-common-release]name=virt7-docker-common-releasebaseurl=http://cbs.centos.org/repos/virt7-docker-common-release/x86_64/os/gpgcheck=0
Installation Services
Execute the following command to install the Kubernetes
-y install --enablerepo=virt7-docker-common-release kubernetes
Next start Deployment:
disabling firewalls
systemctl disable iptables-services firewalldsystemctl stop iptables-services firewalld
启动 etcd docker flannel 服务:
1、先启动etcd:
systemctl enable etcd.service
systemctl start etcd.service
2 Configuring Flannel
Edit/etc/sysconfig/flanneld on Master, node, modify red section
[Email protected] ~]# Vi/etc/sysconfig/flanneld
# Flanneld configuration options# etcd URL location. Point the server where ETCD runsflannel_etcd_endpoints= "http://etcd:2379"# ETCD config key. This is the configuration key, flannel queries# for address range assignmentflannel_etcd_prefix= "/atomic.io/network" # Any additional options, want to Pass#flannel_options= ""
3 Configuring the key for flannel in ETCD
Flannel is configured with ETCD to ensure configuration consistency across multiple flannel instances, so the following configuration is required on the ETCD: ('/atomic.io/network/config ' This key with the above/etc/sysconfig/ The configuration item in flannel Flannel_etcd_prefix is relative, the wrong start will be error)
[[email protected] ~]# etcdctl mk/atomic.io/network/config ' {"Network": "10.0.0.0/16"} ' {"Network": "10.0.0.0/16"}
4 start
After you start flannel, you need to restart Docker in turn
In master execution:
Systemctl enable Flanneld.service Systemctl start Flanneld.service service Docker restart
Execute on Node:
Systemctl enable Flanneld.service Systemctl start Flanneld.service service Docker restart
Configuring the Kubernetes service on the master node
1. Modify the file/etc/kubernetes/config (all nodes)
Note that both master and slave hosts have to be modified
Specify the IP of the master host, and the file contents are as follows:
$ cat /etc/kubernetes/configKUBE_LOGTOSTDERR="--logtostderr=true"KUBE_LOG_LEVEL="--v=0"KUBE_ALLOW_PRIV="--allow-privileged=false"KUBE_MASTER="--master=http://master:8080"
1. Modify the configuration file/etc/etcd/etcd.conf to ensure that the ETCD listens to all addresses. The contents are as follows:
$ cat /etc/etcd/etcd.confETCD_NAME=defaultETCD_DATA_DIR="/var/lib/etcd/default.etcd"ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
2. Modify the configuration file/etc/kubernetes/apiserver
cat /etc/kubernetes/apiserverKUBE_API_ADDRESS="--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,ResourceQuota"KUBE_API_ARGS=""
3. Modify the configuration file/etc/kubernetes/controller-manager, define the slave host IP address
KUBELET_ADDRESSES="--machines=master地址"
On the master host, start the service
Execute the following command to start the service in bulk
in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICESdone
Slave node Configuration
Note: The slave node host is also installed Docker,flannel, k8s
Yum installation Kubernetes
yum -y install
flannel docker
-y install --enablerepo=virt7-docker-common-release kubernetes
1. Modify the Kubernetes configuration file to specify master.
$ cat /etc/kubernetes/configKUBE_MASTER="--master=http://master:8080"
2. Configure the Kubelet service.
$ cat /etc/kubernetes/kubeletKUBELET_ADDRESS="--address=0.0.0.0"KUBELET_PORT="--port=10250"KUBELET_HOSTNAME="--hostname-override=node自身"KUBELET_API_SERVER="--api-servers=http://master:8080"
On the slave host, start the service
for SERVICES in kube-proxy kubelet docker flanneld; do systemctl restart $SERVICES systemctl enable $SERVICES systemctl status $SERVICESdone
Verify
Login Master now to confirm the status of slave
$ kubectl get nodesNAME LABELS STATUS AGE10.16.93.182 kubernetes.io/hostname=node1 Ready 1h
这样就配置完成了
Deploying the Kubernetes cluster on CentOS7