CentOS 7 Kubernetes 安装和配置

部署环境

操作系统:CentOS 7

Kubernetes版本: v1.5.2

Etcd版本:

Docker版本:

第一章、安装Master

内核更新:

yum update -y 

关闭防火墙
systemctl disable firewalld
systemctl stop firewalld

1、安装etcd
yum install -y etcd

systemctl daemon-reload
systemctl enable etcd
systemctl start etcd
etcdctl cluster-health

2、安装kubernetes
yum install -y kubernetes

1)配置kube-apiserver
vim /usr/lib/systemd/system/kube-apiserver.service

#修改配置
After=etcd.service
Wants=etcd.service

vim /etc/kubernetes/apiserver
#修改配置

KUBE_ETCD_SERVERS="--etcd-servers=http://47.52.159.14:2379"

KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"


vim /etc/kubernetes/config
#修改配置
KUBE_LOG_LEVEL="--v=2"
KUBE_MASTER="--master=http://47.52.159.14:8080"

服务启动
systemctl daemon-reload
systemctl enable kube-apiserver
systemctl start kube-apiserver
systemctl status kube-apiserver

2)配置kube-controller-manager
vim /usr/lib/systemd/system/kube-controller-manager.service

#修改配置
After=kube-apiserver.service
Requires=kube-apiserver.service

服务启动
systemctl daemon-reload
systemctl enable kube-controller-manager
systemctl start kube-controller-manager
systemctl status kube-controller-manager

3)配置kube-scheduler
vim /usr/lib/systemd/system/kube-scheduler.service

#修改配置
After=kube-apiserver.service
Requires=kube-apiserver.service

服务启动
systemctl daemon-reload
systemctl enable kube-scheduler
systemctl start kube-scheduler

systemctl status kube-scheduler


第二章、安装Node

内核更新:
yum update -y 

关闭防火墙
systemctl disable firewalld
systemctl stop firewalld

2、安装kubernetes
yum install -y kubernetes

3、安装Docker
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh --mirror Aliyun

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://573b0ee5.m.daocloud.io  
systemctl restart docker.service

4、配置kubelet

vim /usr/lib/systemd/system/kubelet.service
无需配置

vim /etc/kubernetes/config
修改配置:
KUBE_MASTER="--master=http://47.52.159.14:8080"

vim /etc/kubernetes/kubelet
修改配置:
KUBELET_API_SERVER="--api-servers=http://47.52.159.14:8080"

systemctl daemon-reload
systemctl enable kubelet
systemctl start kubelet
systemctl status kubelet

5、配置kube-proxy 

vim /usr/lib/systemd/system/kube-proxy.service
修改配置:
添加:Requires=network.service

vim /etc/kubernetes/proxy
无需修改

systemctl daemon-reload
systemctl enable kube-proxy
systemctl start kube-proxy
systemctl status kube-proxy

你可能感兴趣的:(容器化)