码迷,mamicode.com
首页 > Web开发 > 详细

kubernetes 1.13 install

时间:2018-12-11 21:52:01      阅读:326      评论:0      收藏:0      [点我收藏+]

标签:serve   mkdir   yun   内容   util   tst   inf   bec   编辑   

 

 

 

External Dependencies           kubernetes

    • Default etcd server is unchanged at v3.2.24 since Kubernetes 1.12. (#68318)
    • The list of validated docker versions remain unchanged at 1.11.1, 1.12.1, 1.13.1, 17.03, 17.06, 17.09, 18.06 since 

docker install

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r

yum -y install docker-ce-18.06.1.ce-3.el7
systemctl start docker
systemctl enable docker

 

1. 准备阶段

1.1 组建规划

主机名地址角色组件
k8s-m1 10.16.32.85 k8s-master etcd、kube-apiserver、kube-controller-manager、kube-scheduler
k8s-g1 10.16.32.86 k8s-node kubelet、docker、kube_proxy
k8s-g2 10.16.32.87 k8s-node kubelet、docker、kube_proxy

1.2 软件下载

(1) Kubernetes二进制文件下载

https://github.com/kubernetes/kubernetes/releases

https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG-1.13.md#v1130-beta2
从上边的网址中选择相应的版本,从 CHANGELOG页面 下载二进制文件,本文以1.13版本为例,

 技术分享图片

 在/root/kubernetes/server/bin 路径下包含一些必须的组件   binary文件如下

 技术分享图片

(2) etcd数据库下载

https://github.com/coreos/etcd/releases/
这里选用的是最新版本v3.3.10。

 

2. Master安装

2.1 etcd数据库安装

(1)安装

将下载的etcd文件包进行解压,解压后将etcd、etcdctl二进制文件复制到/usr/bin目录。

(2)设置服务文件etcd.service

在/usr/lib/systemd/system/目录下创建文件etcd.service,内容为:

mkdir /var/lib/etcd/
vim /usr/lib/systemd/system/etcd.service
[Unit]
Description=Etcd Server

[Service]
Type=notify
TimeoutStartSec=0
Restart=always
WorkingDirectory=/var/lib/etcd/
EnvironmentFile=-/etc/etcd/etcd.conf
ExecStart=/usr/bin/etcd 

[Install]
WantedBy=multi-user.target

 

(3)创建配置文件/etc/etcd/etcd.conf
ETCD_NAME=ETCD Server
ETCD_DATA_DIR="/var/lib/etcd/"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://10.16.32.85:2379"

(4)配置开机启动并运行

systemctl daemon-reload
systemctl enable etcd.service
systemctl start etcd.service

(5)检验etcd是否安装成功

etcdctl cluster-health

技术分享图片

 

2.2 kube-apiserver、kube-controller-manager、kube-scheduler服务安装

2.2.1 复制二进制文件到/usr/bin目录

将kube-apiserver、kube-controller-manager、kube-scheduler 三个可执行文件复制到/usr/bin目录

2.2.2 组件安装及配置
2.2.2.1 kube-apiserver

(1)新建并编辑kube-apiserver.service 文件
路径:/usr/lib/systemd/system/kube-apiserver.service,内容为:

[Unit]
Description=Kubernetes API Server
After=etcd.service
Wants=etcd.service

[Service]
EnvironmentFile=/etc/kubernetes/apiserver
ExecStart=/usr/bin/kube-apiserver          $KUBE_ETCD_SERVERS         $KUBE_API_ADDRESS         $KUBE_API_PORT         $KUBE_SERVICE_ADDRESSES         $KUBE_ADMISSION_CONTROL         $KUBE_API_LOG         $KUBE_API_ARGS 
Restart=on-failure
Type=notify
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target
    • 其中EnvironmentFile为kube-apiserver的配置文件
      (2)配置文件
      apiserver配置文件路径为:/etc/kubernetes/apiserver,内容为:
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
KUBE_API_PORT="--insecure-port=8080"
KUBE_ETCD_SERVERS="--etcd-servers=http://10.16.32.85:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=192.168.0.0/16"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
KUBE_API_LOG="--logtostderr=false --log-dir=/var/log/kubernets/apiserver --v=2"
KUBE_API_ARGS=" "
2.2.2.2 kube-controller-manager

(1)新建并编辑kube-controller-manager.service 文件
路径:/usr/lib/systemd/system/kube-controller-manager.service,内容为:

[Unit]
Description=Kubernetes Scheduler
After=kube-apiserver.service 
Requires=kube-apiserver.service

[Service]
EnvironmentFile=-/etc/kubernetes/controller-manager
ExecStart=/usr/bin/kube-controller-manager         $KUBE_MASTER         $KUBE_CONTROLLER_MANAGER_ARGS
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

 

(2)配置文件
apiserver配置文件路径为:/etc/kubernetes/controller-manager,内容为:

KUBE_MASTER="--master=http://10.16.32.85:8080"
KUBE_CONTROLLER_MANAGER_ARGS=" "
2.2.2.3 kube-apiserver

(1)新建并编辑kube-scheduler 文件
路径:/usr/lib/systemd/system/kube-scheduler.service,内容为:

[Unit]
Description=Kubernetes Scheduler
After=kube-apiserver.service 
Requires=kube-apiserver.service

[Service]
User=root
EnvironmentFile=-/etc/kubernetes/scheduler
ExecStart=/usr/bin/kube-scheduler         $KUBE_MASTER         $KUBE_SCHEDULER_ARGS
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

(2)配置文件
kube-scheduler配置文件路径为:/etc/kubernetes/scheduler,内容为:

KUBE_MASTER="--master=http://10.16.32.85:8080"
KUBE_SCHEDULER_ARGS="--logtostderr=true --log-dir=/var/log/kubernetes/scheduler --v=2"
2.2.3 将各组件加入开机自启
systemctl daemon-reload 
systemctl enable kube-apiserver.service
systemctl start kube-apiserver.service
systemctl enable kube-controller-manager.service
systemctl start kube-controller-manager.service
systemctl enable kube-scheduler.service
systemctl start kube-scheduler.service

2.3 安装完后检验正确

运行命令 kubectl get cs

技术分享图片

 

 

3 Node安装

Node节点上安装组件有:

  • docker
  • kube-proxy
  • kubelet

3.1 docker安装

Docker的版本需要与kubelete版本相对应,最好都使用最新的版本。

3.2 拷贝 kubelet、kube-proxy

在之前解压的 kubernetes 文件夹中拷贝二进制文件



 

 

 

 

 

kubernetes 1.13 install

标签:serve   mkdir   yun   内容   util   tst   inf   bec   编辑   

原文地址:https://www.cnblogs.com/blogscc/p/10105134.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!