一、kube-apiserver :集羣核心,集羣API接口、集羣各個組件通訊的中樞;集羣安全控制; 二、kube-scheduler: 集羣調度器 ,根據node負載(cpu、內存、存儲、策略等)將pod分配到合適node。 三、kube-controller-manager:集羣狀態管理器 。當集羣狀態與集羣指望值不一樣時,該控制器會根據已有策略將其恢復到指定狀態。 kube-scheduler、kube-controller-manager 和 kube-apiserver 三者的功能緊密相關,前須要部署在同一臺機器上。 四、etcd 一個高可用的K/V鍵值對存儲和服務發現系統node
注意:集羣只能有一個 kube-scheduler、kube-controller-manager 進程處於工做狀態,若是運行多個,則須要經過選舉產生一個 leaderlinux
一、kubelet 在Node節點上按照配置文件中定義的容器規格啓動容器 二、kube-proxy 提供網絡代理服務,將service與pod打通。 三、flannel 實現誇主機的容器網絡的通訊 四、docker 這個就不用說了!docker
一、關閉防火牆服務,避免與docker容器的防火牆規則衝突。api
[root@localhost ~]# systemctl disable firewalld [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1)
二、關閉selinux 修改/etc/selinux/config爲SELINUX=disabled安全
[root@localhost ~]# getenforce Disabled
kubernetes-master (包含:kube-apiserver、kube-scheduler、kube-controller-manager) etcd服務器
[root@localhost ~]# yum install etcd kubernetes-master -y
ETCD_DATA_DIR="/var/lib/etcd/default.etcd" ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379" #監聽全部IP的2379端口 ETCD_NAME="default" #etcd名字,沒有高可用只有一臺的話可用默認! ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
### # kubernetes system config # # The following values are used to configure the kube-apiserver # # The address on the local server to listen to. KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0" # The port on the local server to listen on. KUBE_API_PORT="--port=8080" # Port minions listen on KUBELET_PORT="--kubelet-port=10250" # Comma separated list of nodes in the etcd cluster KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.1.201:2379" # Address range to use for services KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" # default admission control policies KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,ResourceQuota" # Add your own! KUBE_API_ARGS=""
KUBE_MASTER="--master=http://127.0.0.1:8080" 默認指向本機不需修改!網絡
[root@master01 ~]# etcdctl mk /atomic.io/network/config '{"Network":"172.80.0.0/16"}'
[root@node01 ~]# yum install kubernetes-node flannel -y
# Flanneld configuration options # etcd url location. Point this to the server where etcd runs FLANNEL_ETCD_ENDPOINTS="http://192.168.1.201:2379" # 192.168.1.201爲etcd所在服務器的IP(可設置多個--高可用)! # etcd config key. This is the configuration key that flannel queries # For address range assignment FLANNEL_ETCD_PREFIX="/atomic.io/network" # Any additional options that you want to pass #FLANNEL_OPTIONS=""
### # kubernetes system config # # The following values are used to configure various aspects of all # kubernetes services, including # # kube-apiserver.service # kube-controller-manager.service # kube-scheduler.service # kubelet.service # kube-proxy.service # logging to stderr means we get it in the systemd journal KUBE_LOGTOSTDERR="--logtostderr=true" # journal message level, 0 is debug KUBE_LOG_LEVEL="--v=0" # Should this cluster be allowed to run privileged docker containers KUBE_ALLOW_PRIV="--allow-privileged=false" # How the controller-manager, scheduler, and proxy find the apiserver KUBE_MASTER="--master=http://192.168.1,201:8080" #192.168.1.201爲master所在服務器的IP!
### # kubernetes kubelet (minion) config # 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 on KUBELET_PORT="--port=10250" # You may leave this blank to use the actual hostname KUBELET_HOSTNAME="--hostname-override=192.168.1.202" #192.168.1.202爲本機node的IP! # location of the api-server KUBELET_API_SERVER="--api-servers=http://192.168.1.201:8080" #192.168.1.201爲apiserver所在服務器的IP! # pod infrastructure container KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest" # Add your own! KUBELET_ARGS=""