centos7 install k8s
Posted 杭州糊涂虫
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 install k8s相关的知识,希望对你有一定的参考价值。
参考:
http://blog.opskumu.com/k8s-cluster-centos7.html
https://ylinux.org/note/article/1207
http://mubanjiu.com/2016/05/05/Docker-K8S/
1.四个机器
192.168.179.133 master
192.168.179.134 etcd
192.168.179.135 minion1 docker
192.168.179.136 minion2 docker
2.分别安装
master : flannel kubernetes docker docker-registry
etcd : flannel etcd
minion1: flannel kubernetes docker
minion2: flannel kubernetes docker
备忘:记得按以上应用启动。
3.安装使用
yum -y install etcd flannel kubernetes docker
4.
所有节点关闭 selinux , 设置 /etc/sysconfig/selinux
:
SELINUX=disabled
5.关防火墙
systemctl stop firewalld
systemctl disable firewalld
6.时间同步
yum -y install ntp systemctl start ntpd systemctl enable ntpd
7. etcd
配置文件:
/etc/etcd/etcd.conf
systemctl enable etcd
systemctl start etcd
查看当前集群成员
# etcdctl member list
8.flannel
配置文件:
/etc/sysconfig/flanneld
启动flanneldsystemctl start flanneld
添加flanneld为开机启动systemctl enable flanneld
配置 flannel
通信网段
etcdctl mk /atomic.io/network/config \'{"Network":"172.17.0.0/16"}\'
etcdctl get /
atomic.io
/network/config
9.master 节点配置
Master 配置文件修改
/etc/kubernetes/apiserver
10. master 启动服务
kube-apiserver
kube-controller-manager
kube-scheduler
启动相关服务
for SERVICES in kube-apiserver kube-controller-manager kube-scheduler; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
11.minion 配置
Minion 配置文件修改
/etc/kubernetes/config
/etc/kubernetes/kubelet
如果有私服
配置flanneld : /etc/sysconfig/flanneld
FLANNEL_ETCD="http://192.168.179.134:2379"
minion的flanneld 服务也要启动
12.minion 启动服务
- kubelet
- proxy
- cadvisor
- docker
systemctl daemon-reload
for SERVICES in kube-proxy kubelet flanneld docker; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
13.master查看节点
kubectl get nodes
表示成功!! 祝贺!!晚安!!
20171104 01:48
hangzhou jueshifengqing
14.安装私有仓库(可以单独机器部署 也可以 跟master放一起)
这里采用跟master放一起
docker run -d -p 80:5000 -v /data/docker-registry/private:/var/lib/registry --restart=always --name=registry_private registry:2
测试:
15.其他 docker环境 想使用这个私服 需要配置。由于各minion上都有docker,所以需要 各minion上配置
registry配置改成私有仓库(所有机器)
http://www.cnblogs.com/hutuchong/p/7749666.html
参考我的博客
- vi /usr/lib/systemd/system/docker.service
- ExecStart=/usr/bin/docker -d --insecure-registry 192.168.1.103:5000 -H fd:// $OPTIONS $DOCKER_STORAGE_OPTIONS
所有minion如上修改
--insecure-registry 192.168.179.133:80
16.
备注:将服务设置为自动启动,并启动服务systemctl enable kubelet
systemctl enable kube-proxy
systemctl start kubelet
systemctl start kube-proxy
以上是关于centos7 install k8s的主要内容,如果未能解决你的问题,请参考以下文章
环境初始化 Build and Install the Apache Thrift IDL Compiler Install the Platform Development Tools(代码片段