官方的文档写的很清楚

https://kubernetes.io/docs/getting-started-guides/centos/centos_manual_config/

如果已经安装过docker需要卸载

yum remove docker-engine

安装还是有冲突

[root@here ~]# rpm -aq | grep docker
docker-common-1.10.3-59.el7.centos.x86_64
[root@here ~]# yum remove docker…………
[root@here ~]# rpm -qa | grep container-selinux
container-selinux-1.10.3-59.el7.centos.x86_64
增加yum repo
修改/etc/yum.repos.d/virt7-docker-common-release.repo
[virt7-docker-common-release]
name=virt7-docker-common-release
baseurl=http://cbs.centos.org/repos/virt7-docker-common-release/x86_64/os/
gpgcheck=0
安装组件
yum -y install --enablerepo=virt7-docker-common-release kubernetes etcd flannel

假设机器地址为
echo "192.168.121.9    centos-master
192.168.121.65 centos-minion-1
192.168.121.66 centos-minion-2
192.168.121.67 centos-minion-3" >> /etc/hosts

配置  /etc/kubernetes/config 同步到所有服务器
# 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 replication controller and scheduler find the kube-apiserver
KUBE_MASTER="--master=http://centos-master:8080"
关闭防火墙
setenforce 0
systemctl disable iptables-services firewalld
systemctl stop iptables-services firewalld
配置主节点etcd
/etc/etcd/etcd.conf
# [member]
ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379" #[cluster]
ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379"
配置主节点 /etc/kubernetes/apiserver 
# The address on the local server to listen to.
KUBE_API_ADDRESS="--address=0.0.0.0" # The port on the local server to listen on.
KUBE_API_PORT="--port=8080" # Port kubelets listen on
KUBELET_PORT="--kubelet-port=10250" # Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://centos-master:2379" # Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16" # Add your own!
KUBE_API_ARGS=""
启动etcd
systemctl start etcd
etcdctl mkdir /kube-centos/network
etcdctl mk /kube-centos/network/config "{ \"Network\": \"172.30.0.0/16\", \"SubnetLen\": 24, \"Backend\": { \"Type\": \"vxlan\" } }"
配置所有机器的 /etc/sysconfig/flanneld
# Flanneld configuration options

# etcd url location.  Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://centos-master:2379" # etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/kube-centos/network" # Any additional options that you want to pass
#FLANNEL_OPTIONS=""
主节点启动服务
for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler flanneld; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
启动api-server的时候报错
unable to load server certificate: open /var/run/kubernetes/apiserver.key: permission denied
修改了文件的全险为755可以通过 查看浏览器 https://master-ip:6443/swagger-ui 在胚胎机器上配置  /etc/kubernetes/kubelet
# The address for the info server to serve on
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
# Check the node number!
KUBELET_HOSTNAME="--hostname-override=centos-minion-n" # Location of the api-server
KUBELET_API_SERVER="--api-servers=http://centos-master:8080" # Add your own!
KUBELET_ARGS=""
在节点上启动服务
for SERVICES in kube-proxy kubelet flanneld docker; do
systemctl restart $SERVICES
systemctl enable $SERVICES
systemctl status $SERVICES
done
配置 kubectl (配置一次即可 其他机器共享)
kubectl config set-cluster default-cluster --server=http://centos-master:8080
kubectl config set-context default-context --cluster=default-cluster --user=default-admin
kubectl config use-context default-context
运行检查
$ kubectl get nodes
NAME LABELS STATUS
centos-minion-1 <none> Ready
centos-minion-2 <none> Ready
centos-minion-3 <none> Ready

 

kubernetes install for centos的更多相关文章

  1. How to: cgminer (Bitcoin, Litecoin etc.) + AMD Radeon driver install on CentOS

    UPDATE 7/7/13: If you want to use Catalyst drivers version 12.8 you will find that X won’t start (er ...

  2. kubernetes里面有时候centos源用不了

    kubernetes里面有时候centos源用不了,快速配一个阿里云的源. mkdir /etc/yum.repos.d/yangback;mv /etc/yum.repos.d/* /etc/yum ...

  3. centos7 install k8s centos 安装 kubernetes 详细

    参考: http://blog.opskumu.com/k8s-cluster-centos7.html https://ylinux.org/note/article/1207 http://mub ...

  4. glibc2.14 install from centos

    安装glibc2.14 Tar xf glibc-2.14.tar.gz Cd glibc-2.14 Mkdir build Cd build ../configure –prefix=/opt/gl ...

  5. nginx install in centos

    1.在nginx下载rpm包,如nginx-release-centos-6-0.el6.ngx.noarch.rpm ,并安装(可用yum直接安装): 注:rpm包只是提供一个nginx源. 2.使 ...

  6. RabbitMq install on Centos

    安装服务(root) erlang官方安装说明:https://www.erlang-solutions.com/resources/download.html step 1: 安装erlang的yu ...

  7. How To install FFMPEG, FLVTOOL2, MP4Box on CentOS server 2015 easy method

    for i386:wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpmrpm ...

  8. Install Google Chrome on Fedora 28/27, CentOS/RHEL 7.5 (在 fedora 28 等 上 安装 chrome)

    今天在使用 fedora 安装 chrome 的时候遇到了问题,今天进行将安装过程进行记录下来.需要安装第三方软件仓库. 我们需要进行安装 fedora-workstation-repositorie ...

  9. Install MySQL 5.7 on Fedora 25/24, CentOS/RHEL 7.3/6.8/5.11

    MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user ...

随机推荐

  1. dxRangeTrackBar使用教程

    Properties: Max:最大值 Min:最小值 Frequency:设置刻度值多大值显示PageSize:选择时跳动的区域大小 SelectionColor:选择区域颜色 ShowSelect ...

  2. windows media player 官方修复工具下载及修复方法

    http://download.microsoft.com/download/E/2/3/E237A32D-E0A9-4863-B864-9E820C1C6F9A/MicrosoftFixit.Win ...

  3. NYOJ 92

    1.深搜(会爆栈,通过开全局栈模拟递归) 爆栈代码 # include<iostream> # include<string> # include<string.h> ...

  4. ROS开发与常用命令

    初始化ROS的catkin工作空间:catkin_init_workspace 编译ROS的catkin工作空间:catkin_make 读取当前catkin工作空间的环境变量:source deve ...

  5. Python重要网址

    极客学院视频:http://www.jikexueyuan.com/path/python/ 知乎爬虫:https://www.zhihu.com/collection/129856874?page= ...

  6. async和await用法(Task)

    原文:async和await用法 要理解async和await的用法,首先要了解Task相关知识,这里不做说明,因为这不是本文的重点. 如果你已经对Task很了解,那么如何使用async和await, ...

  7. 数据库页已标记为 RestorePending,可能表明磁盘已损坏。要从此状态恢复,请执行还原操作。

    错误提示: 消息 829,级别 21,状态 1,第 1 行 数据库 ID 15,页 (1:21826) 已标记为 RestorePending,可能表明磁盘已损坏.要从此状态恢复,请执行还原操作. 引 ...

  8. js 检查文件格式和文件大小

    之前有个工作需要用到js检查文件大小和文件格式,网上查了下有个兄弟写的不错,拿过来就能直接用,感谢他顺便记录下.原始文章地址http://www.jb51.net/article/43498.htm ...

  9. 部署一个不依赖tomcat容器的应用

    一个task项目,应用里边都是一些定时任务.我和新入职的高开商定程序部署不依赖于tomcat. 计划赶不上变化,任务开发完成还没等上线呢,哥们要离职了.工作交接时大概说了一下上线怎么部署. 结果呢,当 ...

  10. Vue+webpack项目中实现跨域的http请求

    目前Vue项目中对json数据的请求一般使用两个插件vue-resource和axios, 但vue-resource已经不再维护, 而axios是官方推荐的且npm下载量已经170多万,github ...