This article describes how to quickly deploy a set of kubernetes clusters, so let's get started quickly!
Preparatory work
//关闭防火墙systemctl stop firewalld.servicesystemctl disable firewalld.service//关闭selinux,修改/etc/selinux/configSELINUX=disabled
Machine Deployment Planning
Host |
IP |
Deploying Components |
Master Master Node |
192.168.199.206 |
ETCD, Kube-apiserver, Kube-controller-manager, Kube-scheduler |
Node1 child nodes |
192.168.199.159 |
Kubelet, Kube-proxy, Docker |
Node2 child nodes |
192.168.199.175 |
Kubelete, Kube-proxy, Docker |
The k8s components are installed in a Yum-mount manner for quick installation.
Master Node
//install etcd[[email protected] ~]# yum install-y etcd//Modify/etc/etcd/etcd.conf configuration file [[email protected ] ~]# vim/etc/etcd/etcd.confetcd_listen_client_urls= "http://0.0.0.0:2379" etcd_advertise_client_urls= "/HTTP/ 192.168.199.206:2379 "//Configure ETCD intranet information [[email protected] ~]# etcdctl set/atomic.io/network/config ' {" Network ":" 172.17.0.0/16 "} ' PS: where the network number 172.17.0.0/16 with the DOCKER0 network in Docker (if not consistent, can modify the DOCKER0 network or configure the above ETCD network); Atomic.io corresponds to Flannel_etcd_prefix in the flannel configuration below;//run ETCD service [[email protected] ~]# systemctl start Etcd[[email protected] ~]# systemctl enbale etcd
Install kubernetes-master[[email protected] ~]# yum install-y kubernetes-master//Modify/etc/kubernetes/apiserver configuration file [ [email protected] ~]# vim/etc/kubernetes/apiserverkube_api_address= "--insecure-bind-address=0.0.0.0" KUBE_ etcd_servers= "--etcd-servers=http://192.168.199.206:2379"//Modify/etc/kubernetes/config configuration file [[email protected] ~]# vim/etc/kubernetes/configkube_master= "--master=http://192.168.199.206:8080"//Run MASTER service [[email Protected] ~]# systemctl start kube-apiserver kube-scheduler kube-controller-manager[[email protected] ~]# Systemctl Enable Kube-apiserver Kube-scheduler Kube-controller-manager//test service, if output the following data, the service is OK. [[email protected] ~]# curl-l http://192.168.199.206:8080{"Paths": ["/api", "/api/v1", "/apis", "/api S/apps ","/apis/apps/v1beta1 ","/apis/authentication.k8s.io ","/apis/authentication.k8s.io/v1beta1 ","/apis/au Thorization.k8s.io ","/apis/authorization.k8s.io/v1beta1 ","/apis/autoscaling ","/apis/autoscaling/v1","/apis/batch ","/apis/batch/v1 ","/apis/batch/v2alpha1 ","/apis/certificates.k8s.io ","/apis/certificate S.k8s.io/v1alpha1 ","/apis/extensions ","/apis/extensions/v1beta1 ","/apis/policy ","/apis/policy/v1beta1 ", "/apis/rbac.authorization.k8s.io", "/apis/rbac.authorization.k8s.io/v1alpha1", "/apis/storage.k8s.io", "/apis/st Orage.k8s.io/v1beta1 ","/healthz ","/healthz/ping ","/healthz/poststarthook/bootstrap-controller ","/healthz/p Oststarthook/extensions/third-party-resources ","/healthz/poststarthook/rbac/bootstrap-roles ","/logs ","/metrics ","/swaggerapi/","/ui/","/version "]
Node nodes (same as 159 and 175 installation methods)
//安装docker[[email protected] ~]# yum install -y docker
//安装flannel [[email protected] ~]# yum install -y flannel//修改/etc/sysconfig/flannel配置文件[[email protected] ~]# vim /etc/sysconfig/flannelFLANNEL_ETCD_ENDPOINTS="http://192.168.199.206:2379"
//安装kubernetes-note[[email protected] ~]# yum install -y kubernetes-node//修改/etc/kubernetes/config配置文件[[email protected] ~]# vim /etc/kubernetes/configKUBE_MASTER="--master=http://192.168.199.206:8080"//修改/etc/kubernetes/kubelet配置文件[[email protected] ~]# vim /etc/kubernetes/kubeletKUBELET_HOSTNAME="--hostname-override=192.168.199.159"KUBELET_API_SERVER="--api-servers=http://192.168.199.206:8080"//运行服务systemctl enable kubelet kube-proxy systemctl start kubelet kube-proxy
Managing node nodes on the master machine
[[email protected] ~]# kubectl get nodesNAME STATUS AGE192.168.199.159 Ready 32m192.168.199.175 Ready 4m
Rapid deployment of Kubernetes cluster management