kubernetes部署
处理好selinux iptables firewalld ( iptables -P FORWARD ACCEPT)
master 228
node 229 230
所有节点安装docker-ce
master中
sed -i 's#http://127.0.0.1:2379#http://192.168.3.228:2379#g' /etc/sysconfig/flanneld
vim /etc/etcd/etcd.conf (etcd可单独,能集群)
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379" 这个参数不能测试用下面的
ETCD_LISTEN_CLIENT_URLS="http://192.168.3.228:2379,http://172.16.0.228:2379,http://127.0.0.1:2379" 此值为监听地址
ETCD_ADVERTISE_CLIENT_URLS="http://192.168.3.228:2379"
systemctl restart etcd && systemctl enable etcd flanneld
etcdctl set name [test]
etcdctl get name 会输出上面[test] ,相对于nosql
vim /etc/kubernetes/apiserver
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://192.168.3.228:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" (默认)
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota" (删除倒数第二个证书认证删除,除非在外网)
vim /etc/kubernetes/config (这个先不改,node节点需要改,如果这个改了mastar也是node)
systemctl enable kube-apiserver kube-controller-manager kube-scheduler etcd flanneld
systemctl restart kube-apiserver kube-controller-manager kube-scheduler etcd flanneld
------------------------------node1/2--------------------------------------------
yum localinstall -y node/*
安装报错情况下卸载下面两个软件 yum remove docker-ce-cli docker-ce
---------------------------------------------------------------------------------------------------------------
Error: docker-ce-cli conflicts with 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64
Error: docker-ce conflicts with 2:docker-1.13.1-109.gitcccb291.el7.centos.x86_64
---------------------------------------------------------------------------------------------------------------
sed -i 's#http://127.0.0.1:2379#http://192.168.3.228:2379#g' /etc/sysconfig/flanneld
vim /etc/kubernetes/config
KUBE_MASTER="--master=http://192.168.3.228:8080"
vim /etc/kubernetes/kubelet
KUBELET_ADDRESS="--address=192.168.3.229/230"(本地)
KUBELET_HOSTNAME="--hostname-override=192.168.3.229/230" (本地)
KUBELET_API_SERVER="--api-servers=http://192.168.3.228:8080" (master)
systemctl enable kubelet kube-proxy flanneld
systemctl restart kubelet kube-proxy flanneld
[root@mastar ~]# kubectl get nodes 获取节点
NAME STATUS AGE
192.168.3.229 NotReady 3s
192.168.3.230 Ready 17m
[root@mastar ~]# kubectl describe node 获取节点详细信息
[root@mastar ~]# etcdctl mk /atomic.io/network/config '{"Network":"10.99.0.0/16"}'
{"Network":"10.99.0.0/16"}
[root@mastar ~]# etcdctl get /atomic.io/network/config
{"Network":"10.99.0.0/16"}
所有主机的 vim /usr/lib/systemd/system/docker.service都要在ExecStart=/usr/bin/dockerd-current \插入--insecure-registry=192.168.3.228:5000 \ (私有regisrty)