官方的文档写的很清楚

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. 004-js-md5

    参看地址:https://www.bootcdn.cn/blueimp-md5/

  2. Z字形扫描

    #include<cstdio> #include<iostream> #include<algorithm> #include<vector> #in ...

  3. python进制转换及变量

    .编译型语言和解释型语言的区别? 答: () 编译型语言:是将所有源码编译完成二进制后才进行输出,运行快,执行效率高,时间周期长. ()解释型语言:逐行编译输出,执行效率相对慢,开发效率高, .Pyt ...

  4. 基于Apache Spark机器学习的客户流失预测

    流失预测是个重要的业务,通过预测哪些客户可能取消对服务的订阅来最大限度地减少客户流失.虽然最初在电信行业使用,但它已经成为银行,互联网服务提供商,保险公司和其他垂直行业的通用业务. 预测过程是大规模数 ...

  5. MySQL高效的前提

    好硬件是数据库高效的前提,没有好硬件其他优化都是白费 高性能的CPU 主频高SQL处理的更快 3级cache大CPU计算速率更快 多线程,同时并发处理SQL 关闭NUMA并设置为最大性能模式,充分利用 ...

  6. 石子合并(区间DP经典例题)

    题目链接:https://www.luogu.org/problemnew/show/P1880 #include <cstdio> #include <cmath> #inc ...

  7. CentOS系统 cd命令的使用

    直接输入 cd 命令 ,它将切换到你的 home 目录下,不管你当前所在的目录是什么: [ec2-user@ip-*** /]$ cd [ec2-user@ip-*** ~]$ cd /var/www ...

  8. winrar自解压释放路径详解

    因为在 WINRAR 的帮助文件中没有对自解压路径和系统的环境变量之间作说明,所以,很多人只知道,其自解压路径可以智能定位到系统的 PROGRAM FILES 目录,而不知道它其实还可以智能定位到系统 ...

  9. xshell 禁用铃声 提示音

    xshell 的铃声在操作时比较烦,所以通常会关闭. 操作方法: 工具 > 选项 > 高级, 在“终端”选项下的 “禁用铃声” 前面打上勾, 确定即可.

  10. 回车和刷新以及Ctr+F5的区别

    回车(url跳转)主要是判断本地缓存文件的Expires的有效时间,如果有效则直接使用客户端缓存 不在提交到HTTP服务器 F5 Expires设置不再起效果,只有Last-Modified/ETag ...