墙内kubernetes v1.15 体验--1:基础环境搭建

一、背景

近期换了新mac,终于有了500GB的空间,决定在本机上部署kubernetes方便进一步对Service Mesh的探索。

二、环境搭建

为方便部分从零开始用虚拟机搭建的同学,从零开始记录下环境的构建。

1、本地环境

macOS 10.14版本;
CPU: 1.4G节能版i5;
内存:16GB;
磁盘:500GB SSD;

2、构建依赖

虚拟机:virtualbox 6.0.10;
VirtualBox 下载地址
操作系统:Ubuntu Server 16.04 LTS;
Ubuntu 下载地址
docker: 19.03.1;
kubernetes: v1.15.0;

3、基础环境构建过程

1)安装Ubuntu虚拟机

启动VirtualBox,新建一个Ubuntu虚拟机,选择本地Ubuntu Server ISO文件,配置4GB内存,2核CPU,20GB磁盘(Kubernetes要求CPU核数至少为2,过小的内存也会造成master卡顿无法正常运行)。
正常安装Ubuntu Server。

2) NAT网络配置

按照如下操作步骤添加一个全局的nat网络,为方便后续做端口映射等操作。


网络配置

设置完毕,将ubuntu添加到该NAT网络内。


Ubuntu网络添加到NAT
3)更新Ubuntu源

使用默认的Ubuntu源下载非常慢,为提高效率及体验,我们设置Ubuntu源为阿里云的Ubuntu源。
备份 /etc/apt/sources.list ,并更新内容如下:

 # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse

更新系统源:

sudo apt-get update
4)添加docker源并安装
# add dependency
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# install GPG key
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# add docker source
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" 
# update and install docker
sudo apt-get update
sudo apt-get -y install docker-ce

执行 docker version 查看状态。

你可能感兴趣的:(墙内kubernetes v1.15 体验--1:基础环境搭建)