K8S搭建详细实践
系统初始化
-
- 关闭防火墙执行命令
-
-
-
systemctl disable firewalld
-
systemctl stop firewalld
-
- 配置yum
-
打开https://opsx.alibaba.com/mirror找到相应的repo配置文件,并下载到/etc/yum.repos.d目录下
cd /etc/yum.repos.d/
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
vim kubernetes.repo;只需要把以下内容拷贝过去即可
[kubernetes]
name=Kubernetes Repo
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
enabled=1
使用#yum repolist生成新源;
yum clean all
yum update
-
- 关闭selinux
#临时关闭: setenforce 0 #永久关闭 sed -i 's/SELINUX=permissive/SELINUX=disabled/' /etc/sysconfig/selinux sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
-
- 关闭NetworkManager
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
-
-
关闭postfix服务
-
systemctl stop postfix.service
systemctl disable postfix.service
-
-
配置host主机名解析;
-
vim /etc/hosts
拷贝以下内容,并且把这个hosts文件拷贝到其他机器上
10.41.12.122 k8s-master 10.41.12.130 k8s-node1 10.41.12.138 k8s-node2
搭建Master
-
-
安装K8S
-
配置yum仓库
a.
- 搭建Node