Kubernetes+Docker的云平台在CentOS7系统上的安装
1.运行VirtualBox5。
2.安装CentOS7系统。
注意:选择Basic Server类型
安装过程略。
3.修改计算机IP和计算机名。
1)nmtui
1.
修改主机名:
nmcli general hostname slave1.smartmap.com
2.
修改网络连接
nmcli connection edit enp0s3
nmcli> goto ipv4
nmcli ipv4> set method manual
nmcli ipv4> set addresses 192.168.1.203/16
nmcli ipv4> set gateway 192.168.0.6
nmcli ipv4> set dns-search smartmap.com
nmcli ipv4> set dns 192.168.0.3 192.168.0.12
nmcli ipv4> back
nmcli> save
nmcli> goto connection
nmcli ipv4> set autoconnect true
nmcli ipv4> back
nmcli> save
nmcli> goto ipv4
nmcli> q
3.重启网卡
systemctl restart network.service
4.关闭selinux。
1)
vi /etc/sysconfig/selinux
修改SELINUX=enforcing为SELINUX=disabled
2)
reboot
5.关闭firewall。
systemctl stop firewalld.service
systemctl disable firewalld.service
reboot
Master主机上安装
6.添加OpenStack的YUM库。
Master主机上安装
yum install kubernetes etcd flannel
Slave机上安装
yum install kubernetes flannel
7.启动Docker服务并下载镜像。
systemctl start docker.service
systemctl enable docker.service
docker pull centos
docker pull index.tenxcloud.com
docker pull index.tenxcloud.com/centos:latest
8.配置Kubernetes。
1)生成RSA证书
openssl genrsa -out /etc/kubernetes/service.key 2048
2)设定控制器的证书
vi /etc/kubernetes/controller-manager
KUBE_CONTROLLER_MANAGER_ARGS="--service_account_private_key_file=/etc/kubernetes/service.key"
3)设定APIServer的配置
vi /etc/kubernetes/apiserver
KUBE_API_ADDRESS="--address=0.0.0.0"
KUBE_ETCD_SERVERS="--etcd_servers=http://192.168.1.201:2379"
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
KUBE_API_ARGS="--service_account_key_file=/etc/kubernetes/service.key"
4)设定master(管理节点)的配置
vi /etc/kubernetes/config
KUBE_MASTER="--master=http://192.168.1.201:8080"
9.配置ETCD。
vi /etc/etcd/etcd.conf
ETCD_LISTEN_PEER_URLS="http://192.168.1.201:2380,http://localhost:2380"
ETCD_LISTEN_CLIENT_URLS="http://192.168.1.201:2379,http://localhost:2379"
10.启动Kubernetes服务。
systemctl start etcd kube-apiserver kube-controller-manager kube-scheduler
systemctl enable etcd kube-apiserver kube-controller-manager kube-scheduler
11.配置Flannel。
1)创建配置信息
vi flannel-config.json
{
"Network":"172.16.0.0/16",
"SubnetLen":24,
"Backend":{
"Type":"vxlan",
"VNI":1
}
}
2)配置文件
vi /etc/sysconfig/flanneld
FLANNEL_ETCD="http://192.168.1.201:2379"
3)将Flannel的配置信息写入ETCD服务中
etcdctl set atomic.io/network/config < flannel-config.json
12.启动Flanneld服务。
systemctl start flanneld
systemctl enable flanneld
原文地址:https://www.cnblogs.com/gispathfinder/p/9535274.html