CentOS 7.3下Docker Kubernetes1.8.3集群环境搭建(10)

创建启动文件flanneld.service:

[root@mimo222 ~]# vi /etc/systemd/system/flanneld.service # 添加以下信息: [Unit] Description=Flanneld overlay address etcd agent After=network.target After=network-online.target Wants=network-online.target After=etcd.service Before=docker.service [Service] Type=notify ExecStart=/usr/local/bin/flanneld \\ -etcd-cafile=/etc/kubernetes/ssl/ca.pem \\ -etcd-certfile=/etc/flanneld/ssl/flanneld.pem \\ -etcd-keyfile=/etc/flanneld/ssl/flanneld-key.pem \\ -etcd-endpoints=https://10.0.11.222:2379 \\ -etcd-prefix=/kubernetes/network ExecStartPost=/usr/local/bin/mk-docker-opts.sh -k DOCKER_NETWORK_OPTIONS -d /run/flannel/docker Restart=on-failure [Install] WantedBy=multi-user.target RequiredBy=docker.service

-etcd-endpoints :填写etcd配置的URL,注意使用https。

-etcd-prefix:上面第一步设置的Pod网段key前缀。我设置的key为/kubernetes/network/config,因此前缀为/kubernetes/network。

注意CA验证证书的路径是否正确。

启动 flanneld:

[root@mimo222 ~]# systemctl daemon-reload [root@mimo222 ~]# systemctl enable flanneld [root@mimo222 ~]# systemctl start flanneld [root@mimo222 ~]# systemctl status flanneld 安装kubelet、kube-proxy [root@mimo222 ~]# cd /tmp/kubernetes # master节点安装时使用过这个文件,拷到node节点即可 [root@mimo222 ~]# wget https://dl.k8s.io/v1.8.3/kubernetes-server-linux-amd64.tar.gz [root@mimo222 ~]# tar -xzvf kubernetes-server-linux-amd64.tar.gz [root@mimo222 ~]# cd kubernetes [root@mimo222 ~]# cp -r server/bin/{kube-proxy,kubelet} /usr/local/bin/ 配置 kubelet.service 文件 [root@mimo222 ~]# mkdir /var/lib/kubelet [root@mimo222 ~]# vi /etc/systemd/system/kubelet.service [Unit] Description=Kubernetes Kubelet Documentation=https://github.com/GoogleCloudPlatform/kubernetes After=docker.service Requires=docker.service [Service] WorkingDirectory=/var/lib/kubelet ExecStart=/usr/local/bin/kubelet \ --cgroup-driver=cgroupfs \ --address=10.0.11.221 \ --hostname-override=10.0.11.221 \ --pod-infra-container-image=jicki/pause-amd64:3.0 \ --experimental-bootstrap-kubeconfig=/etc/kubernetes/bootstrap.kubeconfig \ --kubeconfig=/etc/kubernetes/kubelet.kubeconfig \ --cert-dir=/etc/kubernetes/ssl \ --cluster_dns=10.254.0.2 \ --cluster_domain=cluster.local. \ --hairpin-mode promiscuous-bridge \ --allow-privileged=true \ --fail-swap-on=false \ --serialize-image-pulls=false \ --logtostderr=true \ --max-pods=512 \ --v=2 [Install] WantedBy=multi-user.target

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/3610a734fcb0347b51bf15379c90ac67.html