在 Docker 上安装 Nfs

install nfs in docker

1. create share directory used by nfs

1
mkdir -p /home/ooooo/shared/nfs

2. create exports.txt used by nfs

This the exports.txt mainly used to mount dir (path in the container ) and permission.

在 Centos 上安装 K8s

1. 两台机器初始化设置

1.1 hostname 设置

1
2
3
hostnamectl ## 查看当前的hostname
hostnamectl set-hostname centos1 ## 设置主机名为centos1, 在 192.168.130.131 上执行
hostnamectl set-hostname centos2 ## 设置主机名为centos1, 在 192.168.130.132 上执行

1.2 /etc/hosts 文件 (两个机器都需要)

1
2
3
192.168.1.8 ooooo
192.168.130.131 centos1 ## k8s master
192.168.130.132 centos2 ## k8s worker

1.3 创建非 root 用户 (两个机器都需要)

1
2
useradd ooooo -g ooooo  ## 添加用户,两个机器都执行
passwd ooooo ## 修改用户密码,两个机器都执行

1.4 添加 yum 代理 (两个机器都需要)

1
2
sudo vim /etc/yum.conf ## 编辑 yum 配置文件
proxy=http://ooooo:10800 ## 在文件中添加一行

1.5 安装 docker 服务 (两个机器都需要)

官方 docker 安装文档