Single

Kubernetes部署

一、环境规划

操作系统:CentOS7.4_x64
kubernetes安装目录:/opt/kubernetes
版本说明:
Kubernetes:v1.9
Docker:v17.12.0-ce
Etcd:3.1
角色IP组件
master192.168.1.195etcd kube-apiserver kube-controller-manager kube-scheduler
node01192.168.1.196kube-proxy kubelet docker flannel
node02192.168.1.197kube-proxy kubelet docker flannel

安装Docker环境

Ubuntu:
sudo apt-get -y remove docker docker-engine docker-ce docker-ce-cli docker.io
sudo apt-get -y update
sudo apt-get -y install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
curl -fsSL "${DOCKER_EE_URL}/ubuntu/gpg" | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=$(dpkg --print-architecture)] $DOCKER_EE_URL/ubuntu \
   $(lsb_release -cs) \
   stable-$DOCKER_EE_VERSION"
sudo apt-get -y update
sudo apt-get -y install docker-ee docker-ee-cli containerd.io

Centos:
yum -y install epel*
curl -fsSL https://get.docker.com -o get-docker.sh && bash get-docker.sh 
systemctl start docker ;systemctl enable docker

sudo usermod -aG docker your-user
配置国内镜像加速:
vi /etc/docker/daemon.json
{
  "registry-mirrors": [ "https://registry.docker-cn.com"]
}
# systemctl start docker
# systemctl enable docker

安装Etcd

下载二进制包:
yum install etcd –y
vi /etc/etcd/etcd.conf
按下图进行修改:
systemctl start etcd
systemctl enable etcd
Kubernetes部署

部署Flannel网络

master:
1)写入分配的子网段到ETCD,提供给flannel网络使用
etcdctl -endpoint="http://192.168.1.195:2379" set /coreos.com/network/config  '{ "Network": "172.17.0.0/16", "Backend": {"Type": "vxlan"}}'

2)node节点下载二进制包
# wget https://github.com/coreos/flannel/releases/download/v0.9.1/flannel-v0.9.1-linux-amd64.tar.gz
# tar zxvf flannel-v0.9.1-linux-amd64.tar.gz
# mv flanneld mk-docker-opts.sh /usr/bin

文章有(2)条网友点评

发表评论